# Suppose that both $p$ and $p^2 +2$ are prime numbers. Show that $p=3$. [duplicate]

Can someone help me out with this? I've been working on it for quite a long time but I'm not sure if I'm even getting anywhere.

If $p$ is a prime other than 3, then $p \equiv 1 \bmod 3$ or $p \equiv 2 \bmod 3$. But either way $p^2 \equiv 1 \bmod 3$, which means that $p^2 + 2 \equiv 0 \bmod 3$, which means $p^2 + 2$ must be composite. But if $p = 3$, then $p^2 + 2 = 11$, which is prime.
If you're not convinced, try out a few cases of $p^2 + 2$:
• $5^2 + 2 = 27 = 3^3$
• $7^2 + 2 = 51 = 3 \times 17$
• $11^2 + 2 = 123 = 3 \times 41$
Hint: Suppose $p \neq 3$. What does that mean is true of $p \mod 3$? What does that mean for $p^2 \mod 3$?