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](https://oeis.org/A107008) 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$.



p^2 dividing n^8-n^4+1
Your conjecture is true in the light of the following statements.


**Proposition 1.** A prime $p$ has the form $x^2+24y^2$ if and only if $p\equiv 1\pmod{24}$.


**Proposition 2.** A prime square $p^2$ divides $\Phi\_{24}(n)$ for some $n$ if and only if $p\equiv 1\pmod{24}$.


**Proof of Proposition 1.** The four equivalence classes of binary quadratic forms of discriminant $-96$ are represented by $x^2+24y^2$, $3x^2+8y^2$, $4x^2+4xy+7y^2$, $5x^2+2xy+5y^2$. Looking at the values in $(\mathbb{Z}/96\mathbb{Z})^\times$ assumed by these four quadratic forms, we see that they are in four different genera. This means that if $Q(x,y)$ is any of these forms and $p\geq 5$ is any prime, then $Q(x,y)$ represents $p$ if and only if it does so modulo $96$. In particular, $x^2+24y^2$ represents $p$ if and only if $p\equiv 1,25,49,73\pmod{96}$, i.e. when $p\equiv 1\pmod{24}$.


**Proof of Proposition 2.** By Hensel's Lemma, the square of a prime $p\geq 5$ divides $\Phi\_{24}(n)$ for some $n$ if and only if $p$ divides $\Phi\_{24}(m)$ for some $m$. The latter property holds if and only if $\mathbb{F}\_p$ contains a primitive $24$-th root of unity, i.e. when $p\equiv 1\pmod{24}$.


**References:** Rose - A course in number theory; Cox - Primes of the form $x^2+ny^2$


