How to use prove this $p^4\equiv p\pmod {13}$ 
Let a prime number $p$, and $n$ a positive integer such $$p\mid n^4+n^3+2n^2-4n+3.$$
Show that $$p^4\equiv p\pmod {13}.$$

A friend of mine suggested that I might be able to use the results problem.
 A: The key idea here is that the polynomial $ P(X) = X^4 + X^3 + 2X^2 - 4X + 3 $ is not arbitrarily chosen. If $ \alpha $ denotes a root of this polynomial over $ \mathbf Q $, then $ \mathbf Q(\alpha) $ is the unique quartic subfield of $ \mathbf Q(\zeta_{13}) $ - in fact, we have
$$ \alpha = \zeta_{13} + \zeta_{13}^{3} + \zeta_{13}^{9} $$
(where $ 1, 3, 9 $ are the fourth powers mod $ 13 $, of course.) If the polynomial $ P $ has a root mod $ p $, then the prime $ p $ splits completely in the quartic subfield, and that's equivalent to the subfield being fixed by the Frobenius element corresponding to the prime $ p $, which is the automorphism given by extending $ \zeta_{13} \to \zeta_{13}^p $. It's easy to see this automorphism fixes the subfield if and only if $ p $ is a fourth power mod $ 13 $, which is a condition equivalent to $ p^4 \equiv p \pmod{13} $. The proof is completely analogous to the one of quadratic reciprocity. (This argument ignores the case when $ p = 13 $, which is the only ramified prime in $ \mathbf Q(\zeta_{13}) $, but in this case the claim $ p^4 \equiv p \pmod{13} $ is trivially satisfied.)
A more down-to-earth version of the same argument can be given by considering the Frobenius automorphism over $ \mathbf F_p $, in which case not quite as much algebraic number theory needs to be brought to bear on the question, but the spirit of the argument remains the same.
A: Assume that $\ne3,13$. Let $\zeta\ne1$ be a $13$th root of unity in $F_p$ and let
$$ 
a=\zeta+\zeta^3+\zeta^9, \quad
b=\zeta^2+\zeta^6+\zeta^{12}, \quad
c=\zeta^4+\zeta^{12}+\zeta^{24}, \quad\text{and}\quad
d=\zeta^8+\zeta^{16}+\zeta^{48};
$$
it can be verified that 
$$ (x-a)(x-b)(x-c)(x-d) = x^4+x^3+2x^2-4x+3. \tag{$*$} $$
(This is how the polynomial $(*)$ was constructed.)
By the condition, $n$ is a root of $(*)$; w.l.o.g $a=n\in F_p$.
Notice that $c=\frac{3-2a-a^3}{3}\in F_p$, and
$$
(x-\zeta)(x-\zeta^3)(x-\zeta^9) = x^3-ax^2+cx-1. \tag{**}
$$
This polynomial is either irreducible over $F_p$ or all its roots are in $F_p$; in both cases $\zeta\in F_{p^3}$. Then $ord(\zeta)=13$ divides $|F_{p^3}^*|=p^3-1$.
A: Using pari/gp.
? f(n)=n^4+n^3+2*n^2-4*n+3;
?
? for(r=0,12,print1(f(Mod(r,13))", "))
Mod(3, 13), Mod(3, 13), Mod(1, 13), Mod(0, 13), Mod(1, 13), Mod(3, 13), Mod(3, 13), Mod(9, 13), Mod(1, 13), Mod(9, 13), Mod(9, 13), Mod(1, 13), Mod(9, 13),

I.e. $f(n)\equiv 0,1,3,9 \pmod{13}$.
Solve $p^4\equiv p \pmod{13}$:
? polrootsmod('p^4-'p,13)
%1 = [Mod(0, 13), Mod(1, 13), Mod(3, 13), Mod(9, 13)]~

Any powering and product primes of form $0,1,3,9 \pmod{13}$ is again $0,1,3,9 \pmod{13}$.
Thus $p\mid f(n) \iff p^4\equiv p\pmod {13}$.
A: Proof for the case when $n\bmod 13 \neq 3$
Let $n\bmod 13 = k$. Then, by substituting $k=0,1,\ldots,12$ and $k\neq 3$, we have
$$\left[n^4+n^3+2n^2-4n+3\right]\bmod 13= \left[k^4+k^3+2k^2-4k+3\right]\bmod 13\in\{1,3,9\},$$
which are all  powers of $3$. Now, notice that $$n^4+n^3+2n^2-4n+3\bmod p=0\implies p\bmod 13 \in\{ 1,3, 9\},\tag{1}$$
since  $p\bmod 13\neq 0$ as $p$ is a prime number. 
Finally, we deduce that
\begin{align}
p^4\bmod 13&=\left[p^4-p + p\right]\bmod 13\\
&=\left[p(p-1)(p^2+p+1)+ p\right]\bmod 13\\
&=\left[p(p-1)(p^2+p-12) + p\right]\bmod 13\\
&= \left[p(p-1)(p-3)(p+4)+ p\right]\bmod 13\\
&=\left[p(p-1)(p-3)(p-9)+ p\right]\bmod 13 \\
&= p\bmod 13.
\end{align}
where we use $(1)$. 
A: My take on this problem is to solve the quartic equation using the quartic formula. To use this formula, the $x^3$ term needs to be eliminated, which can be done by substituting $y=x-\frac {1}{4}$. The result is, after quite a bit of algebra, is
$y^4+\frac{13}{8} y^2 - \frac{39}{8}y -\frac{1053}{256}=0$
To solve this, use the cubic resolvent. For $y^4+py^2+qy+r$ this is
$z^3+2pz^2+(p^2-4r)z-q^2=0$
This yields
$z^3+\frac{13}{4}z^2-\frac{221}{16}z-\frac{1521}{64}=0$
Solve this using the cubic formula, which involves eliminating the $z^2$ term with $w=z-\frac{13}{16}$. After a lot more algebra, one finds that the roots are $\frac{13}{4}$, $\frac{-13+2\sqrt(13)}{4}$, and $\frac{-13-2\sqrt(13)}{4}$. That means that a root of the reduced quartic is
$\frac{1}{2}  (\sqrt(\frac{13}{4})+\sqrt(\frac{-13+2\sqrt(13)}{4}) + \sqrt(\frac{-13-2\sqrt(13)}{4})$
Going back to the original quartic, one get, as one of the roots
$-\frac{1}{4}+\frac{1}{2}  (\sqrt(\frac{13}{4})+\sqrt(\frac{-13+2\sqrt(13)}{4}) + \sqrt(\frac{-13-2\sqrt(13)}{4})$
Now if we take this polynomial mod 13, all the square root stuff beyond the $-\frac{1}{4}$ is zero, so a root mod 13 is $-\frac{1}{4}$. By trial and error or solving a diophantine equation, one gets that $-\frac{1}{4}=3$ mod 13. Then note that $3^4 = 3$ mod 13, which gives the intended result.
A: We will have modulo $13$ all the time. Notice that $$N:= n^4+n^3+2n^2-4n+3 \equiv (n^2-6n-4)^2 \equiv (n-3)^4$$
Clearly $13\mid N\iff 13\mid n-3$, so we assume $p\ne 13$ and thus $13$ does not divide $n-3$. Say prime divisor $p$ of $N$ is good if $p^4{\equiv}p$. 
Suppose the statment is not true, so there exists a prime $q$ which is not good. 
Also we can assume that there is no good prime divisor of $N$: if $p\ne 13$ is good than we can divide $N$ by $p\equiv p^4$ modulo $13$ and then observe $N' = N/p^4$ modulo $13$.  Also we can reduce $N$ with all divisors of $N$ of form $d^4$. So if we make now a prime factorisation for $N$ modulo $13$ we have $$N\equiv  2^a4^b5^c6^d7^e8^f10^g11^h12^i$$
(clearly there is no $0,1,3$ and $9$) where all the exponents are nonnegative and less than $4$ and at least one is positive. Of course, we can reduce this even more:
$$N\equiv  2^{a+2b+d+3f+g+2i} 3^{d+i} 5^{c+g}7^e11^h$$
or $$N\equiv  2^x 3^y 5^z(-6)^e(-2)^h$$
where or exponents are nonegative and less than $4.$ Again we can assume if $y=0$ (else we divide $N$ by $3$ modulo $13$). So we can write:$$ N\equiv  (-1)^{3z+e+h} 2^{x+3z+e+h} = (-1)^t2^{x+t}$$
where $t= 3z+e+h$. So $$N\equiv   -1\pm2,\pm4,\pm8$$
Now this can not be of the form $(...)^4$ and we have a contradiction.
