# If $p$ is prime, $p\ne3$ then $p^2+2$ is composite

I'm trying to prove that if $p$ is prime,$p\ne3$ then $p^2+2$ is composite. Here's my attempt:

Every number $p$ can be put in the form $3k+r, 0\le r \lt 3$, with $k$ an integer. When $r=0$, the number is a multiple of 3, so that leaves us with the forms $3k+1$ and $3k+2$. The first one will be even when $k$ is odd, and the second one will be even when $k$ is even. So we will see what happens for each form in the case that $k$ is even (for the first form) and $k$ is odd (for the second form):

1. $p=3k+1$, $k$ is even

Since $k$ is even, we can write it as $k=2q$ for some $q$. Then

$p^2+2=(3(2q)+1)^2+2=(6q+1)^2+2=6^2q^2+12q+1+2=3(12q^2+4q+1)$

So $p^2+2$ is composite.

1. $p=3k+2$, $k$ is odd

Then, $k$ can be written as $k=2q+1$, for some $q$. Then

$p^2+2=(3(2q+1)+2)^2+2=(6q+5)^2+2=6^2q^2+60q+25+2=3(12q^2+10q+9)$

And again, $p^2+2$ is composite.

QED

Is that a correct proof? Is not the same that comes in the answer books.

• FYI, this reminds me of what I considered to be a "cute" question that I found. It is #$16$ at Northwestern U's Putnam Training Number Theory, and it says "If $p$ and $p^2 + 2$, are primes show that $p^3 + 2$ is prime". Of course, the only prime which meets even the first $2$ conditions is $3$, with it also meeting the $3$rd condition, resulting in the statement being true for all primes. – John Omielan Feb 16 '19 at 2:46

Yes, it is correct. However, there's a much shorter proof (which is essentially the same as yours): If $p$ is not divisible by $3$, then $p=3k+1$ or $p=3k+2$; then $p^2$ leaves a remainder of $1$ when divided by $3$ ($p^2\equiv 1\mod{3}$), so that $p^2+2$ is divisible by $3$.

Note by the way that you don't really need $p$ to be prime. All you need is that $p>1$ is not divisible by $3$.

• Oh, I liked that one. Thanks – Allonsy Nov 29 '17 at 19:33

Since $(p-1)p(p+1)$ is product of three consecutive numbers it must be divisible by $3$. Since $p\ne 3$ we see that $3$ divides $p^2-1$. So $p^2+2$ is also divisible by $3$ and since it is more than $3$ it is composite.

if we have $$p\equiv 1 \mod 3$$ then we get $$p^2+2\equiv 0\mod 3$$ and with $$p\equiv 2\mod 3$$ we get $$p^2+2\equiv 4+2\equiv 0\mod 3$$

Another observation is that primes $p\geq 5$ (the remaining $p=2$ can be checked manually) are of the following two forms $6k+1$ or $6k+5$ (simply because $6k+2, 6k+3, 6k+4$ are never primes). Then

• $p^2+2=36k^2+12k+3$ is divisible by 3
• $p^2+2=36k^2+60k+27$ is divisible by 3