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):


*

*$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.


*$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.
 A: 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. 
A: 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$$
A: 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$.
A: 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

