Are there arbitrarily large gaps between consecutive primes?

7.4k Views Asked by At

I made a program to find out the number of primes within a certain range, for example between $1$ and $10000$ I found $1229$ primes, I then increased my range to $20000$ and then I found $2262$ primes, after doing it for $1$ to $30000$, I found $3245$ primes.

Now a curious thing to notice is that each time, The probability of finding a prime in between $2$ multiples of $10000$ is decreasing, i.e it was $$\frac{2262-1229}{10000}=0.1033$$ between $10000$ and $20000$, and $$\frac{3245-2262}{10000}=0.0983$$ between $20000$ and $30000$,

So from this can we infer that there will exist two numbers separated by a gap of $10000$ such that no number in between them is prime? If so how to determine the first two numbers with which this happens? Also I took $10000$ just as a reference here, what about if the gap between them in general is $x$, can we do something for this in generality?

Thanks!

7

There are 7 best solutions below

6
On BEST ANSWER

The Prime Number Theorem states that the number of primes $\pi(x)$ up to a given $x$ is $$\pi(x) \sim \frac{x}{\log(x)}$$ which means that the probability of finding a prime is decreasing if you make your "population" $x$ larger. So yes, there exist a gap of $n$ numbers whereof none are prime.

The way to find the first gap for some $n$ has to be done through the use of software, since the exact distribution of prime numbers is only approximated by $\frac{x}{\log(x)}$.

EDIT: That the PNT implies that there's always a gap of size $n$ can be seen by considering what would happen if this was not the case; if there was a maximum gap of $n$ that was reached after some $x$, the probability of finding a prime between $x$ and some larger number $m$ would no longer decrease as $m \to \infty$, which contradicts the PNT.

18
On

Can we infer that there exist two numbers separated by a gap of $10000$, such that no number in between them is prime?

We can infer this regardless of what you wrote.

For every gap $n\in\mathbb{N}$ that you can think of, I can give you a sequence of $n-1$ consecutive numbers, none of which is prime.

There you go: $n!+2,n!+3,\dots,n!+n$.

So there is no finite bound on the gap between two consecutive primes.

4
On

We cannot infer from the two observations in the question that there are gaps of arbitrary sizes between primes. As Lovsovs mentions in his answer, this does follow from the Prime Number Theorem (one needs suitable error bounds on the approximation $\pi(x) \sim \frac{x}{\log x}$, but even crude ones will do here).

As asked in the comments, it's easy to construct for any positive integer $k$ a sequence of $k$ consecutive composite numbers. For any positive integer $a \leq k + 1$, $a$ divides $(k + 1)!$, and so it divides $(k + 1)! + a$, but this implies that each of the $k$ numbers $(k + 1)! + 2, \ldots, (k + 1)! + (k + 1)$ is composite. (This is generally not the first sequence for which this is true: For example, for $k = 3$, the resulting sequence is $26, 27, 28$, but the first sequence of three consecutive composite positive integers is $8, 9, 10$.)

5
On

The problem of finding large gap between consecutive primes is an old and well studied one. There certainly is a large gap between what we know to be true, and what we suspect.

As for what people expect, Cramer's random provides a good source heuristics. Roughly spreaking, you can think of a number $n$ to be "prime with probability $\frac{1}{\log n}$", but sometimes you also have to take into consideration that the primes tend not to be divisible by $2, 3, 5,$, etc. Apparently, if you make a lot of optimistic assumptions, then you can reach the conclusion that the longest gap between primes in integers $\leq X$ is roughly $\log^2 X$. Hence, if you want your gap to have size $g$, then you should look at integers $\leq e^{\sqrt{g}}$ (which, for $g = 10000$ is pretty large). See this post of Terence Tao for details.

Much less has been proved. The best known bounds for the largest gap between primes is due to Kevin Ford, Ben Green, Sergei Konyagin, James Maynard, Terence Tao, and says that the largest gap below $X$ is at least $ c \frac{\log X \log \log X \log \log \log \log X}{\log \log \log X} $, where $c$ is a constant.

0
On

Any sequence with density $0$, in most reasonable meanings of "density $0$", has arbitrarily large gaps.

This is true (for example, and in increasing order of generality) if density $0$ is interpreted as:

  • the density on $[1,n]$ converges to $0$, or

  • the lim inf of the density on $[1,n]$ is $0$, or

  • the lim inf of the density on intervals of length $n$ is $0$

The asymptotic density of primes $\pi(n)/n \to 0$ is 0-density in the strong sense, which is more than enough to ensure large gaps.

The $n!$ examples of large gaps can be reduced from factorial to "primorial" size and the latter seems to be the best currently known deterministic construction.

0
On

This isn't going to be a fancy answer, (secondary school student) but I would believe it to be as a number rises the number of possible factors of the number also rise meaning there is a larger chance of it having more factors than itself and one. So a number has every number smaller than it as a possible factor, so smaller numbers have less possible factors and therefore less chance of more than 1 factor and itself.

0
On

There several factors determining the size of gaps. As per you example 10,000 has a square root of 100 which give you 25 prime number divisors for the 10,000 and the 20,000 square root is 141 and 34 divisors, and the 30,000 square root is 173 and 40 divisors. The number of divisors helps to determine the gaps. The number of factors needed is based on the square root of your max number. The square roots are decreasing percentage of the max number: example 100 / 10000 = 1.000%, 141 / 20000 = .70500% and 173 / 30000 = .57666%. The number of factors increased against the square root but decreases against the max number. Example: 106,749,747,000,000 the square root is 10,331,977 the square root % is .00000968% with 685,159 factors the max gap in my sample 712. The large gaps seam to have a cycle pattern to them.