Find all primes $p$ such that $$p^2 \mid 5^{p^2} +1$$
Okay, so I got this:
$x = 5^{p^2} +1 = (5^p)^p +1$. In order to use Eulers theorem, I checked that $(5^p, p^2) = 1$, which is true when $p \ne 5$. So, because $\varphi(p^2) = p$, it follows that $(5^p)^p + 1 \equiv 1 + 1 \equiv 2\ (modp)$. So, when $p\ne5$, $x$ is not divisible by $p^2$. Easy to check that it's not divisible for $p=5$.
My textbook says that answer is $p=3$, which is true when I plug it into $x$. So what's wrong with my try ? If the whole approach is wrong, please post solution to this problem, as my textbook only gives final result.
Clearly, $p\ne5$. Then Fermat gives $$ -1 \equiv 5^{p^2} \equiv (5^{p}){^p} \equiv 5^{p} \equiv 5 \bmod p $$ and so $p$ divides $6$. Now $p=2$ does not work but $p=3$ does work.