Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to prove that there is only one $p$ prime number such that $p^2+8$ is prime and find that prime.

Anyway, I just guessed and the answer is 3 but how do I prove that?

share|cite|improve this question
I took the liberty of editing the title of the question to be more informative. – Harald Hanche-Olsen Nov 10 '12 at 9:28
See also: Why does $p^2+8$ prime imply $p^3+4$ prime – Martin Sleziak Sep 28 '15 at 15:58
up vote 11 down vote accepted

Any number can be written as $6c,6c\pm1,6c\pm2=2(3c\pm1),6c+3=3(2c+1)$

Clearly, $6c,6c\pm2,6c+3$ can not be prime for $c\ge 1$

Any prime $>3$ can be written as $6a\pm 1$ where $a\ge 1$

So, $p^2+8=(6a\pm 1)^2+8=3(12a^2\pm4a+3)$.

Then , $p^2+8>3$ is divisible by 3,hence is not prime.

So, the only prime is $3$.

Any number$(p)$ not divisible by $3,$ can be written as $3b\pm1$

Now, $(3b\pm1)^2+(3c-1)=3(3b^2\pm2b+c)$.

Then , $p^2+(3c-1)$ is divisible by 3

and $p^2+(3c-1)>3$ if $p>3$ and $c\ge1$,hence not prime.

The necessary condition for $p^2+(3c-1)$ to be prime is $3\mid p$

$\implies$ if $p^2+(3c-1)$ is prime, $3\mid p$.

If $p$ needs to be prime, $p=3$, here $c=3$

share|cite|improve this answer
thank you but why any prime bigger than 3 can be write this way? – Mary Nov 10 '12 at 9:17
@Nusha: Because any other number is divisible by 2 or 3. Check out the cases $6n$, $6n+2$, $6n+3$, $6n+4$. (And note that $6n+5$ has the form $6n'-1$ with $n'=n+1$.) – Harald Hanche-Olsen Nov 10 '12 at 9:19
@Nusha, may have a look into the edited answer. – lab bhattacharjee Nov 10 '12 at 9:21
It's a fine answer, but if I may be allowed to editorialize a bit on grammar? The phrase “both factors $3$ and $…+3>1$ grates on my nerves. The phrase lists two items, $3$ and $…+3>1$ as if they were of a similar nature, which they are not. Please, either “both factors $3$ and $…+3$ are greater than $1$”, or “both $3>1$ and $…+3>1$”. – Harald Hanche-Olsen Nov 10 '12 at 9:24
@HaraldHanche-Olsen, you can edit it if you want – lab bhattacharjee Nov 10 '12 at 9:27

Suppose there exists a prime $p$ (not equal to 3) such that $p^2 + 8$ is prime. Since $p$ is indivisible by 3, therefore $p \equiv 1 \pmod 3$ or $p \equiv -1 \pmod 3$, therefore $p^2 \equiv 1 \pmod 3$. Thus, $p^2 + 8 \equiv 9 \equiv 0 \pmod 3$, therefore $p^2 + 8$ is a prime greater than 3 that is divisible by 3 (a contradiction).

share|cite|improve this answer

Put $\rm\,q,k = 3\:$ in: $ $ for $\rm\,p\ne q\:$ primes, little Fermat $\rm\,\Rightarrow\, q\:|\: p^{q-1}\!-1+qn\ $ so it is prime iff it $\rm = q.$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.