Considering all integers ∣m∣,∣n∣≤3 we can get the solutions 2=12+12, 5=12+22 and 13=(−3)2+(−2)2. Now, let's prove that there is no other prime numbers satisfying the statement. We have
p=m2+n2⇒p=(m+n)2−2mn⇒mn=2(m+n)2−p,
m3+n3−4=(m+n)3−3mn(m+n)−4=2−(m+n)3+3p(m+n)−8,
p∣m3+n3−4⇒p∣(m+n)3+8.
Hence, p∣m+n+2 or p∣(m+n)2−2(m+n)+4, and from last we conclude that p∣mn−m−n+2, if we set p>2.
In a first case we have:
p∣m+n+2⇒m2+n2≤∣m+n+2∣,
i.e.
m2+n2≤m+n+2⇒(2m−1)2+(2n−1)2≤10⇒−1≤m,n≤2.
m2+n2≤−(m+n+2)⇒(2m+1)2+(2n+1)2≤−6,
which is a contradiction.
In a second case:
p∣mn−m−n+2⇒m2+n2≤∣mn−m−n+2∣,
i.e.
m2+n2≤mn−m−n+2⇒(2m−n+1)2+3(n+1)2≤12⇒−3≤m,n≤1.
m2+n2≤−(mn−m−n+2)⇒(2m+n−1)2+3(n−1/3)2≤−20/3,
which is a contradiction.