First 100s place without a prime

What is the first $$100$$'s place without a prime?

$$700$$ -> primes: $$701, 709, 719$$, etc.

$$103900$$ -> primes: $$103951, 103963, 103967, 103969, 103979$$, etc.

But at some point, there are gaps of hundreds and thousands between prime numbers, so what is the first gap that spans an entire hundred's place?

There is no prime number between $1,671,800$ and $1,671,900$, and this is the first such gap.

SageMath script:

P = Primes()
n = 0
while P.next(n * 100) - (n * 100) < 100:
n += 1
print n * 100 // prints 1671800

• According to this table (trnicely.net/gaps/gaplist.html#MainTable), that is not the first prime gap $\geq 101$. – Jack D'Aurizio Jan 5 '18 at 1:40
• I think he just found out the first gap which is equal to exactly 100 places. – Manish Kundu Jan 5 '18 at 1:41
• As asked, it is the first gap between consecutive multiples of 100. – GEdgar Jan 5 '18 at 1:46
• This is the correct answer. I checked and the two primes are 1671781 and 1671907. All of the other lesser primes that have >100 difference between them fall on consecutive 100s. – John Jan 5 '18 at 1:47
• @ManishKundu: No, Zev's gap is within a 125-gap starting at 1671782. It is just the first one between $100n$ and $100(n+1)$. – Tito Piezas III Jan 5 '18 at 3:16

Here's some Python 3 code that finds all the solutions < 5000000. Un-comment the break statement if you just want the first solution. This script will also run on Python 2, but it will use less RAM if you change range to xrange.

num = 5000000
sieve = num//2 * [True]
for i in range(3, int(num**0.5) + 1, 2):
if sieve[i//2]:
sieve[i*i//2::i] = (1 + (num - i*i - 1) // (2*i)) * [False]
for j in range(0, num // 2, 50):
if not any(sieve[j:j+50]):
print(2*j)
#break


output

1671800
2637800
3117300
3933600
4640600
4652400


This code runs in less than one second on my ancient 2GHz 32 bit machine.

It uses a Sieve of Eratosthenes to find odd primes. The sieve code was derived from code by Robert William Hanks.

I don't think that there is a possible formula for finding gaps. You just get your answer by using some computer code.

The answer is, from the number 370262, there are at least 100 non-prime numbers continuously.

And if you meant to ask the first gap between two consecutive multiples of hundred, then it's from 1671800 till 1671900.

• Yes there is. You can find a gap of size $n-1$ in every sequence: $n!+2,n!+3,\dots,n!+n$. – Klangen Jan 5 '18 at 13:33