If m=0 then p=n2 is a prime, which is impossible. Similar case happens when n=0. So we may assume mn=0. Then p>∣m∣ and p>∣n∣. Note that
m3+n3=(m+n)(m2−mn+n2)≡−mn(m+n)(modp)
So the problem statement is equivalent to
mn(m+n−8)≡0(modp).
Since p>m,n and p is prime, then p∣m+n−8, so m2+n2≤∣m+n−8∣. We have two cases:
1. If m+n−8≥0 then m2+n2≤m+n−8 which means m(m−1)+n(n−1)≤−8. This is impossible, since m(m−1) and n(n−1) are integers and non-negative.
2. If m+n−8<0 then we get m(m+1)+n(n+1)≤7. So we conclude m,n=±3,±2,±1.
By case work we get 3 solutions as follows:
- p=2 when (m,n)=(1,1),
- p=5 when (m,n)=(2,1),
- p=13 when (m,n)=(−3,−2).