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.

• What routes have you tried? Apr 3, 2015 at 3:09
• well i've been working with the fact that since p is prime p^2 + 2 is prime, p can't be even, and thus p^2 is congruent to 1 mod 4. But i'm now doubting that that is the correct route
– user228386
Apr 3, 2015 at 3:16
• @user228386, Related : math.stackexchange.com/questions/234077/prime-p-with-p28-prime Apr 3, 2015 at 4:49
• Related (for what it's worth): $p^3 + 2$ is prime if $p$ and $p^2 + 2$ are prime? Apr 3, 2015 at 8:30

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$?