TITLE: p^2 dividing n^8-n^4+1
QUESTION [16 upvotes]: When trying to see if a number of the form $n^8-n^4+1$ can be divisible by the square of a prime, I found that it can indeed. The first few values for $n$ are
412, 786, 1417, 1818, 2430, 2640, 2809, 2822, 2899 ...
and the first few such primes $p$ (in increasing order) are
73, 97, 193, 241, 313, 337, 409, 433, ...
Interestingly enough, the latter is precisely the beginning of this sequence which lists the primes of the form $x^2+24y^2$. I am quite sure that this cannot be a pure coincidence and that some deep number theory must be involved. The number $24$ is not accidental either, as $n^8-n^4+1=\Phi_{24}(n)$, with $\Phi_k(x)$ being the $k$th cyclotomic polynomial. Maybe there is some relation to the field $\mathbb{Q}(\zeta_{24})$...
So, the question is if the following is true:
Conjecture. A prime $p$ has the form $x^2+24y^2$ if and only if $p^2$ divides $n^8-n^4+1$ for some $n$.

REPLY [6 votes]: There is another proof which is somewhat easier.
Since the multiplicative group of $\mathbb{Z}/p\mathbb{Z}$ is cyclic there exists
$x$ such that $\Phi_{24}(x) = 0 (mod p)$ iff $24 | p-1$. Notice that in this case
$\Phi_{24}(x)$ has $8$ different roots in $\mathbb{Z}/p\mathbb{Z}$ and the derivative
at each root is not divisible by $p$, which implies that any root if $\Phi_{24}$
in $\mathbb{Z}/p\mathbb{Z}$ can be lifted to a root in $\mathbb{Z}/p^k\mathbb{Z}$
(for all $k$) and even in $p$-adics $\mathbb{Z}_p$.
Here there is nothing special about $24$, and one can replace it with any integer.