# Find all positive integers $n$ such that $n$,$n + 2$, and $n + 4$ are all primes…

Find all positive integers $n$ such that $n$,$n + 2$, and $n + 4$ are all primes.

• Having a tough time with this problem, I feel that brute force is a possibility especially considering that my professor said that there are only a small amount of numbers that fit this category, but there has to be a better way. Any help or suggestions are greatly appreciated. I did see a similar post to this question but it did not help me solve this nor did it look to find the same thing, please do not mark this as a duplicate.
• Have you looked at this for small values of $n$, say $n=1,2,3,4,5$? Do you find any small numbers $n$ where this is true? And when you write the three numbers $n$, $n+2$, and $n+4$ for bigger and bigger $n$, what do you find out when you try factoring the three numbers? – Steve Kass Apr 13 '16 at 2:51
• I was feeling like I had already answered this same question a year ago, but it turns out that what I actually answered was a version of this question with an added wrinkle: math.stackexchange.com/questions/1415196/… – Robert Soupe Apr 13 '16 at 3:17
• $\pmod 3 {}{}{}{}{}{}$ – TheRandomGuy Apr 13 '16 at 13:33

Note that one of the three numbers must be a multiple of $3$. So the only possible choice is that one of them is $3$ itself. So $3,5,7$

• Okay so I ran through a few cases, and so far I have 1 and 3 as two of the numbers. I am unsure as to how I would find the last one though? – Nick Powers Apr 13 '16 at 3:06
• @NickPowers In standard notation, $1$ is not counted as a prime number. As others have pointed out, $n$ must not be an even number. Also since one of the three numbers must be a multiple of $3$, we would be composite if the multiple isn't $3$ itself. So we actually only have one case: $3,5,7$ – lEm Apr 13 '16 at 3:19

Brute force can nudge you towards the answer, but you still have to look at and think about the results of brute force. Have your computer give you a few triples factorized and analyze the results.

Obviously, $n$ has to be a prime number. So there is no need to test $n = 0$ or $n = 1$.

Then, with $n = 2$, we see that $n + 2$ can't prime because that's obviously divisible by 2. No need to look at $n = 4$ either. In fact, we don't need to consider any other even $n$.

Moving on to $n = 3$, we obtain the primes 3, 5, 7. Ding, ding, ding!

With $n = 5$, we get the prime 7 but also $9 = 3^2$.

And with $n = 7$, we get $n + 4 = 11$, but $n + 2 = 9 = 3^2$.

Look at this problem modulo 6: if $n$ is odd, it has to be 1 or $5 \pmod 6$ to not be a multiple of 3. But if $n \equiv 1 \pmod 6$, then $n + 2 \equiv 3 \pmod 6$, or if $n \equiv 5 \pmod 6$, then $n + 4 \equiv 3 \pmod 6$.

So this problem has exactly one solution, or exactly two if negative integers are allowed.

• Maybe I'm not understanding something but why are we disregarding 1, wouldn't that yield 1, 3, 5 which fits our conditions? – Nick Powers Apr 13 '16 at 3:08
• Well, if you consider 1 to be a prime number, then this problem has exactly two solutions, or four if negative integers are allowed. – Robert Soupe Apr 13 '16 at 3:10
• Okay that makes sense thank you, unfortunately I am still unclear as to how I would find the remaining applicable numbers, sorry. – Nick Powers Apr 13 '16 at 3:13
• So under that understanding wouldn't this mean the only possible value for n is 3? – Nick Powers Apr 13 '16 at 3:18
• @RobertSoupe If negative numbers are allowed (and if $1$ is considered prime) then every odd $n$ between $-7$ and $3$ is a solution, so there are six. – Erick Wong Apr 13 '16 at 5:44