Let $X$ be a set of primes $p$ so that $5^{p^2}+1 \equiv 0 \pmod {p^2}$ Which of these sets is $X$ equal to? $5^{p^2}+1\equiv 0\pmod {p^2}$
$1.$ $\emptyset $
$2.$ {$3$}
$3.$ All primes of the form $4k+3$
$4.$ All primes except $2$ and $5$
$5.$ All primes
This one is pretty easy to get right through the process of elimination, which is how I solved it (it's $3$). What would be a more rigorous way of solving this?
 A: Clearly $p\neq 2$, because $5^{2^2}+1\equiv 1^{2^2}+1\equiv 2\not\equiv 0\pmod{\! 2^2}$.   
$\ p\mid 5^{p^2}+1\,\Rightarrow\, p\mid 5^{2p^2}-1$ and by little Fermat $p\mid 5^{p-1}-1$.   
See this lemma to get $\,p\mid 5^{(2p^2,\,p-1)}-1=5^2-1=2^3\cdot 3\,\Rightarrow\, p=3$   
$5^{3^2}+1\equiv 125^3+1\equiv (-1)^3+1\equiv 0\pmod{3^2}$, so $\{3\}$ is the set of solutions.    
Relevant lemma: $\,a^{p^{k}}\equiv a^{p^{k-1}}\pmod{p^k}$ (for all $k\ge 1$. see this question).     
So another way of checking: $\,5^{3^2}+1\equiv 5^3+1\equiv 126\equiv 0\pmod{3^2}$.
Or like user225222 did it: $\,\color{#0b4}{5^{p^2}}\stackrel{\text{FLT}}\equiv 5^p\stackrel{\text{FLT}}\equiv 5\equiv \color{#0b4}{-1}\pmod{\! p}\,\Rightarrow\, p\mid 6$
A: In the congruance holds you also have : $5^{p^2}+1\equiv 0 [\rm mod p]$. 
On the other hand $5^p\equiv 5 [\rm mod p]$ ($equation : x^p \equiv x [\rm mod p]$) so we should have $5+1\equiv 0 [\rm mod p]$  (apply equation twice). 
So the only possible primes are 2 or 3. 2 is not a solution and 3 is a solution indeed:
$$5^4+1 \equiv (4+1)^4+1 \equiv 2 [\rm mod 4]$$ 
$$5^9+1 \equiv (9-4)^{9} +1 \equiv  -(4)^{9} +1 \equiv -(8)^6+1 \equiv -1(-1)^6+1 \equiv 0 [ \rm mod 9] $$. 
Hence 3 is the only solution
