Solution:
We write p+q2=a2 with a a positive integer. Then p=a2−q2=(a−q)(a+q), and since p is a prime number the factors a−q and a+q must be equal to ±1 or to ±p. Since a+q is a positive number, a−q must also be positive, and moreover a+q>a−q, so the only possibility is a+q=p, a−q=1. It follows that a=q+1 and p=a2−q2=2q+1.
Suppose now, for contradiction, that p2+qn is a square, p2+qn=b2 with b a positive integer. We have qn=b2−p2=(b−p)(b+p), and therefore, since the only divisors of qn are of the form ±qi with 0≤i≤n, we must have b−p=qi, b+p=qj (as before it is easy to see that both factors are positive) and qi⋅qj=qn, that is, i+j=n; moreover, since b−p<b+p, we have qi<qj. Subtracting the equalities b+p=qj, b−p=qi term by term we obtain 2p=qj−qi=qi(qj−i−1).
We now distinguish the cases i=0 and i>0.
If i=0 we have b−p=1 and b+p=qn: then qn=b+p=2p+1=4q+3, so 3=qn−4q=q(qn−1−4). It follows that q divides 3, so q=3, and simplifying a factor of 3 we arrive at the equation 3n−1−4=1⇒3n−1=5, which has no integer solutions.
If instead i>0, from the equation 2p=qi(qj−i−1) we obtain q∣2p=2(2q+1)⇒q∣2, that is, q=2, p=2q+1=5, and 2p=qi(qj−1−1)⇒10=2i(2j−i−1). It follows that i is equal to 1 (because 2i divides 10) and that 5=2j−1−1, but again this equation has no integer solutions.