Solution:
By Fermat's theorem n2p≡n2(modp), therefore m2+n2+p+1≡n2(modp)⇒m2≡−1(modp).
Case 1: p=4k+3. We have (m2)2k+1≡(−1)2k+1(modp). Therefore,
mp−1≡−1(modp)
and p does not divide m. On the other hand, by Fermat's theorem
mp−1≡1(modp)
(28) and (29) yield p=2. Thus, p=4k+3.
Case 2: p=4k+1. Let us consider (27) in mod 4. n2=0 or 1 in mod 4. In both cases n2p=n2(mod4). From (27) we get n2≡m2+n2+1+1(mod4). Therefore, m2≡−2(mod4), and again there is no solution.
Case 3: p=2. The given equation is written as
n4−n2−3=m2
Let l=n2. Readily, we do not get any solution for l=0, 1. If l=4, then there are four solutions: (3,2,2),(−3,2,2),(3,−2,2),(−3,−2,2). There is no solution for l>4, since in this case
(l−1)2=l2−2l+1<m2=l2−l−3<l2
Thus, (27) has four solutions: (3,2,2),(−3,2,2),(3,−2,2),(−3,−2,2) and we are done.