# Prime numbers

• Mar 20th 2009, 12:04 PM
Apprentice123
Prime numbers
If the numbers p, p+2 and p+4 are primes, find p.
• Mar 20th 2009, 12:16 PM
Moo
Hello,
Quote:

Originally Posted by Apprentice123
If the numbers p, p+2 and p+4 are primes, find p.

- Any integer can be written in the form 3k,3k+1 or 3k+2, for some integer \$\displaystyle k \geq 0\$
- Among these three possibilities, only 3k+1 and 3k+2 can be primes and 3 is a prime.

Now if \$\displaystyle p=3k+1\$
\$\displaystyle {\color{red}p+2=3k+3=3(k+1)}\$
\$\displaystyle p+4=3k+4\$
p+2 is prime if and only if k+1=1, that is k=0. Otherwise, it is a multiple of 3 and hence is not prime.
But p=3x0+1=1 is not a prime.
Hence no prime number in the form 3k+1 satisfy the condition.

Now if \$\displaystyle p=3k+2\$
\$\displaystyle p+2=3k+4\$
\$\displaystyle {\color{red}p+4=3k+6=3(k+2)}\$
p+4 is prime if and only if k+2=1, that is k=-1.
This gives p=-3, p+2=-2, p+4=1.
These are obviously not prime numbers. (they have to be positive).

Now if \$\displaystyle p=3\$, \$\displaystyle p+2=5\$, \$\displaystyle p+4=7\$
They're all prime numbers.
And it's the only possibility for p.
• Mar 20th 2009, 02:28 PM
Apprentice123
Thank you very much, the exercise was not easy.