TITLE: Prove that if $p$ is a prime such that $p^2+2$ is a prime then $p=3$.
QUESTION [6 upvotes]: My problem in my solution is that I don't know if the operations I apply on congruence modulo n are admissible. I could really use some guiding:
Attempt: Let there be $p\ne 3$ fulfilling the requirements aforementioned. Every prime number $p\ne 2,3$ satisfies: $p\equiv1 \mod6$ or $p\equiv5 \mod6$. If $p\equiv1 \mod6$ then $p^2\equiv1 \mod6$ which means  $p^2+2\equiv3 \mod6$ which is a clear contradiction. Here's the tricky part(of which I am not sure): $p\equiv5 \mod6$ $\Rightarrow p^2\equiv5 \mod6$ $\Rightarrow p^2+2\equiv1 \mod6$.
That means by definition: $6|(p^2+2)-1$ and $6|p^2-5$ and therefore(?): $6|p^2-4$ deriving $2p^2\equiv 4 \mod 6$ $\Rightarrow p^2\equiv 2 \mod 6$ which is a contradiction.

REPLY [3 votes]: If $p\neq3$ then $p\equiv 1\ or -1\ (mod\ 3)$ so $p^2\equiv 1\ (mod\ 3)$ so $p^2+2\equiv 0\ (mod\ 3)$ which shows p is divisible by 3 which means $p^2+2$ is not a prime for p not equal to 3. If $p=3$, $p^2+2=9+2=11$ which is a prime.