When I took basic number-theory course there was this exercise to find 2000 consecutive numbers. And of course it's well known that the trick to take numbers of the form $$ (n+1)!+m, \quad 2 \leq m \leq n+1 $$ does the trick with $n=2000$. But these numbers are really huge which makes me think of the following question.

Is there a better way to construct consecutive composite numbers? With better I mean that is there a way to find smaller consecutive composites for each $n$? Or even the smallest?

Example: Smallest 3 consecutive composites are clearly $8,9,10$ but the formula gives us the numbers $26, 27, 28$ and even $14,15,16$ would be smaller. So I'm asking a way to find these smaller/smallest consecutive composites.

  • 2
    $\begingroup$ You may be interested in terrytao.wordpress.com/2014/08/21/… and sciencedirect.com/science/article/pii/S0022314X97920813 . $\endgroup$ Sep 13, 2014 at 11:23
  • $\begingroup$ I don't think there's any way to find the smallest set of, say, 100 consecutive composites that's more efficient than just doing a systematic search. $\endgroup$ Sep 13, 2014 at 12:11
  • $\begingroup$ A couple of relevant references: oeis.org/A008950 and oeis.org/A045881 $\endgroup$ Sep 13, 2014 at 12:14
  • $\begingroup$ @GerryMyerson Yes, I think systematic search might be best. But we could maybe find some kind of estimate where to start looking though. But I think its hard to find considerably better upper bound than $(n+1)!+m$. $\endgroup$ Sep 13, 2014 at 12:27
  • $\begingroup$ @Harto: Yes, it is hard. But if you read Jack Daruzio's first link, you will see that some clever people have done it. $\endgroup$
    – TonyK
    Sep 13, 2014 at 13:37

3 Answers 3


Based on the ideas in Crostul's answer and my comment, I would suggest the following (not necessarily optimal) algorithm: Let $2000$ consecutive integers be denoted by $n, n+1,..., n+1999$. We will put conditions on $n$ so as to make all these integers composite.

(1) Require $n$ to be a multiple of $2$ (and greater than $2$). Then $n$, $n+2$, $n+4$,... are all composite. This condition is equivalent to $n\equiv 0\pmod{2}$.

(2) The first non multiple of $2$ is now $n+1$. So we'll require $3\mid n+1$. Then $n+1$, $n+4$,... are all divisible by $3$. This condition is equivalent to $n\equiv 2\pmod{3}$.

(3) At each subsequent step we determine the smallest integer in our sequence not yet known to be composite, and we force it to be a multiple of the next available prime. This will give us a congruence of the form $n\equiv t\pmod{p_k}$, where $p_k$ is the next available prime, and $t$ is some appropriate integer with $0\le t< p_k$.

Eventually all of $n, n+1, ..., n+1999$ will have to be composite. We'll then have a biggish Chinese Remainder Theorem (CRT) problem to solve for $n$, but this CRT problem will not have anywhere near $2000$ congruences because of identifying so many composites at each step.

  • 4
    $\begingroup$ This is just the Sieve of Eratosthenes in disguise. At step $n$, the "smallest integer in our sequence not yet known to be composite" will be $n+p_n$, where $p_n$ is the $n^{th}$ prime. So the number of congruences will be $303$, the number of primes less than $2000$. $\endgroup$
    – TonyK
    Sep 13, 2014 at 13:42
  • $\begingroup$ @TonyK Good point! $\endgroup$
    – paw88789
    Sep 13, 2014 at 14:40
  • $\begingroup$ I tried doing this and found that all the congruences become $ n \equiv 2 \ (\text{mod}\ p_k) $ for each prime $p_k$ (i.e. each $ t $ is 2). The solution to this is of course $ n \equiv 2 \ (\text{mod} \prod p_k) $. So the solution we're looking for is $ n = 2 + \prod p_k \simeq 10^{842.461460471}$. $\endgroup$ Oct 17, 2016 at 23:40

Well, the tables do not yet go high enough, but look at Prime pair points slope approaches 1

and the websites mentioned. Experience and the Granville-Cramer conjectures suggest that, to get a prime gap of 2000, we should expect the prime at the beginning of the gap to be at least $$ e^{\sqrt {2000}} \approx e^{44.721} \approx 2.64 \cdot 10^{19}, $$ maybe a little bigger.

So, wait a few years, if they get the maximal prime gap tables up to something like $10^{21}$ you would expect to get a gap over 2000. Right now the tables are up to $4 \cdot 10^{18}$

EEEDDDIIITTT: for gaps numbered 52 to 75, the ratio $g / \log^2 p$ is no smaller than $3/4.$ So, taking this as a pessimistic bound, we expect gap 2000 by

$$ e^{\sqrt {8000/3}} \approx e^{51.639} \approx 2.67 \cdot 10^{22}, $$ so maybe best up to $10^{23}$

ESSAY QUESTION: it would appear that finding a gap of fixed size (2000) is nowhere near as difficult as confirming maximal gaps. I would think that there is some low-tech method that could do this, I just do not know whether the entire range from $10^{18}$ to, say, $10^{24},$ can be done in under a year. We need to spend the smallest possible time deciding whether a number is prime or composite; a hierarchy of methods, (I) trial division by primes up to $10,000;$ (II) trial with Fermat's method of difference of squares (III) "probable prime" function from any CAS (IV) prime proof. Actual program to juggle a number of time/storage issues. Need to think about it, but I might do a tiny run with C++/GMP. All can be done because of the $10^{24}$ bound, but i have no idea how slow it would be.

  • $\begingroup$ Well I'm not really intrested in that specific case (It was more of an example). But all the links given give me enough to study for few days at least. But thanks for giving that estimate with Granville-Cramer! $\endgroup$ Sep 13, 2014 at 18:07
  • $\begingroup$ @HartoSaarinen, just be aware that it is entirely conjectural, what can actually be proved about prime gaps is nowhere near this strong. $\endgroup$
    – Will Jagy
    Sep 13, 2014 at 18:14
  • $\begingroup$ If you want to do the entire range, $10^{24}$ is a huge number. There are something like $1.84\cdot 10^{22}$ primes till then, if you spend $c$ clock cycles on each prime (on average), you spend roughly $c\cdot 10^{13}$ CPU-seconds on it, or about $3c\cdot 10^5$ CPU-years. You need a freaking huge cluster to do that under one year. $\endgroup$ Sep 13, 2014 at 19:23
  • $\begingroup$ @DanielFischer, I guess. Pity. $\endgroup$
    – Will Jagy
    Sep 13, 2014 at 19:32

This is a partial answer.

Let's denote by $p_1, \dots, p_{2000}$ the first 2000 prime numbers ($p_1 = 2, p_2 = 3, p_3=5, p_4=7$ and so on)

Then the Chinese Reminder Theorem tells you that the system $$\begin{matrix} n &\equiv0 &\mod p_1 \\ n+1 &\equiv0 &\mod p_2 \\ n+2 &\equiv0 &\mod p_3 \\ &\vdots &\\ n+k-1 &\equiv0& \mod p_k \\ &\vdots&\\ n+1999& \equiv0& \mod p_{2000} \end{matrix}$$

has a unique solution $n \in \{ 0, \dots, p_1 \cdots p_{2000}\}$.

Now if you permute the $p_k$'s you get another unique solution, one of these may be the minimal solution for your problem.

The trouble with this approach is that all permutations of the $p_k$'s are $2000!$, and I have no idea on how finding the best one.

  • $\begingroup$ I think this starting point might be as slow as systematic search. But I thinks its worth looking into! $\endgroup$ Sep 13, 2014 at 12:35
  • $\begingroup$ We can observe that actually you don't need anywhere near $2000$ primes for this solution. For instance $1000$ of any $2000$ consecutive integers will be divisible by $2$. About $1333$ will be divisible by at least one of $2$ and $3$, and so on. $\endgroup$
    – paw88789
    Sep 13, 2014 at 12:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .