8

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?

amWhy
  • 209,954

3 Answers3

17

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
Zev Chonoles
  • 129,973
  • According to this table (http://www.trnicely.net/gaps/gaplist.html#MainTable), that is not the first prime gap $\geq 101$. – Jack D'Aurizio Jan 05 '18 at 01:40
  • 1
    I think he just found out the first gap which is equal to exactly 100 places. – Manish Kundu Jan 05 '18 at 01:41
  • 8
    As asked, it is the first gap between consecutive multiples of 100. – GEdgar Jan 05 '18 at 01: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 05 '18 at 01:47
  • 3
    @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 05 '18 at 03:16
1

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.

1

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.

PM 2Ring
  • 4,844