Problem

Source: Second Saudi Arabia JBMO TST 2019, P3

Tags: number theory



Determine all primes $p$, for which there exist positive integers $m, n$, such that $p=m^2+n^2$ and $p|m^3+n^3+8mn$.