8
$\begingroup$

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?

$\endgroup$
16
$\begingroup$

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

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.

$\endgroup$
0
$\begingroup$

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.