Find all numbers n such that n+1, n+5, n+7, n+11, n+13, n+17, n+23 are all prime

Find all natural numbers $$n$$ such that $$n+1$$, $$n+5$$, $$n+7$$, $$n+11$$, $$n+13$$, $$n+17$$, $$n+23$$ are all prime.

So far I've made the following progress on this problem:

a) n must be even. Otherwise some of the $$n+x$$ numbers would be even (since all $$x$$s are odd), and therefore not prime (they can't all be $$2$$).

b) Analyzing $$n \mod 3$$, it's possible to deduce that $$n$$ must in fact be divisible with $$3$$.

If $$n ≡ 1 (mod 3)$$, then $$n + 5$$ would be divisible by $$3$$, and therefore not a prime.

If $$n ≡ 2 (mod 3)$$, then $$n + 1$$ would be divisible by $$3$$, and therefore not a prime.

c) A similar analysis of $$n \mod 5$$ reveals that the only viable option would be $$n ≡ 1 (mod 5)$$. For any other option one of the numbers would be divisible by $$5$$.

Therefore, $$n$$ could end in either $$1$$ or $$6$$, but since it must be even (point a), then it always ends in $$6$$.

This leaves as candidates all numbers $$6$$, $$36$$, $$66$$, $$96$$, $$126$$, and so on, adding $$30$$ every time.

It's easy to check that $$6$$ is a solution. And I strongly suspect it's the only one, as I checked with a computer all possibilities up to 100 million.

However, I'm not able to prove that it's the only solution.

• My impression is that in dealing with prime gap problems, checking all possibilities up to $100$ million is, like, nothing. Nov 6, 2022 at 13:04
• Why did you stop at 5? Nov 6, 2022 at 13:14
• @LeeMosher You're definitely right. I just did that to not keep my computer running for more than a few minutes. :) And I suspect that being a homework problem it would have a handful of solutions that are not too big. Nov 6, 2022 at 13:14
• Observe that for all $n$ one of those numbers is divisible by seven. They are all pairwise non-congruent. Your claim follows speedily. Nov 6, 2022 at 13:17
• Oh, I now see that @Empy2 must have made the same observation. I'm at my dullest and didn't realize that you were discussing moduli :-( Nov 6, 2022 at 13:31

1 Answer

The numbers $$n+1, n+5, n+7, n+11, n+13, n+17, n+23$$ are pairwise non-congruent modulo seven, because $$1,5,7,11,13,17,23$$ have remainders $$1,5,0,4,6,3,2$$ respectively.

So one of them is a multiple of seven. The only multiple of seven that is a prime is $$7$$ itself. Therefore $$7$$ is one of those numbers leaving $$n=6$$ and $$n=2$$ as the alternatives (as well as $$n=0$$ if that is included into the natural numbers in your book). $$n=6$$ checks out, but $$n=2$$ does not. That doubtful candidate $$n=0$$ won't produce composites, but $$n+1=1$$ is not a prime.