Solution:
Rearranging the equation, 2qn(p+1)=(n+2)(2pq+p+q+1). The left hand side is even, so either n+2 or p+q+1 is even, so either p=2 or q=2 since p and q are prime, or n is even.
If p=2, 6qn=(n+2)(5q+3), so (q−3)(n−10)=36. Considering the divisors of 36 for which q is prime, we find the possible solutions (p,q,n) in this case are (2,5,28) and (2,7,19) (both of which satisfy the equation).
If q=2, 4n(p+1)=(n+2)(5p+3), so n=pn+10p+6, a contradiction since n<pn, so there is no solution with q=2.
Finally, suppose that n=2k is even. We may suppose also that p and q are odd primes. The equation becomes 2kq(p+1)=(k+1)(2pq+p+q+1). The left hand side is even and 2pq+p+q+1 is odd, so k+1 is even, so k=2ℓ+1 is odd. We now have
q(p+1)(2ℓ+1)=(ℓ+1)(2pq+p+q+1)
or equivalently
ℓq(p+1)=(ℓ+1)(pq+p+1)
Note that q∣pq+p+1 if and only if q∣p+1. Furthermore, because (p,p+1)=1 and q is prime, (p+1,pq+p+1)=(p+1,pq)=(p+1,q)>1 if and only if q∣p+1.
Since (ℓ,ℓ+1)=1, we see that, if q∤p+1, then ℓ=pq+p+1 and ℓ+1=q(p+1), so q=p+2 (and (p,p+2,2(2p2+6p+3)) satisfies the original equation). In the contrary case, suppose p+1=rq, so ℓ(p+1)=(ℓ+1)(p+r), a contradiction since ℓ<ℓ+1 and p+1≤p+r.
Thus the possible values of q−p are 2,3 and 5.
Solution 2:
Subtracting 2 and multiplying by −1, the condition is equivalent to
p+11−q1=n+24
Thus q>p+1. Rearranging,
q−p−1=n+24(p+1)q
The expression on the right is a positive integer, and q must cancel into n+2 else q would divide p+1<q. Let (n+2)/q=u a positive integer.
So
q−p−1=u4(p+1)
uq−u(p+1)=4(p+1)
so p+1 divides uq. However, q is prime and p+1<q, therefore p+1 divides u. Let v be the integer u/(p+1). Now
q−p=1+v4∈{2,3,5}
All three cases can occur, where (p,q,n) is (3,5,78), (2,5,28) or (2,7,19). Note that all pairs of twin primes q=p+2 yield solutions (p,p+2,2(2p2+6p+3)).
Solution 3:
Subtract 2 from both sides to get
p+11−q1=n+24
From this, since n is positive, we have that q>p+1. Therefore q and p+1 are coprime, since q is prime.
Group the terms on the LHS to get
q(p+1)q−p−1=n+24
Now (q,q−p−1)=(q,p+1)=1 and (p+1,q−p−1)=(p+1,q)=1 so the fraction on the left is in lowest terms. Therefore the numerator must divide the numerator on the right, which is 4. Since q−p−1 is positive, it must be 1,2 or 4, so that q−p must be 2,3 or 5. All of these can be attained, by (p,q,n)=(3,5,78), (2,5,28) and (2,7,19) respectively.