I recently saw a video about the last digit of prime numbers, that if a prime ends with a digit X then it is the least likely that the next prime also has X as the last digit.

But I counted the prime gaps (modulo 10) for primes between 200 million and 2 billion and the result is this:

  • 0: 15885351
  • 2: 19886835
  • 4: 17246764
  • 6: 18937346
  • 8: 15265989

Why 0 is not the least common prime gap modulo 10? I expected it to be significantly less then any other gaps.

Edit1: Link to the numberphile video

Edit2: below the counts how many times the digit on the left is followed by the digit on the top (for the last digit of primes between 200 million and 2 billion):

        1       3       5       7       9
1 4047130 6467273       0 6526597 4763818
3 5250387 3896688       0 6133642 6525043
5       0       0       0       0       0
7 5557028 5885706       0 3893204 6469289
9 6950273 5556094       0 5251784 4048329

You see the counts in the main diagonal are much lower than any other.

  • $\begingroup$ Um, why should it be? Could you link to the video and/or summarize it's argument about why 0 would be least? I can't think of any reason why 10 should be less then any other (for numbers large enough for gaps of multiples of 10 to be common). $\endgroup$ – fleablood May 13 '16 at 16:02
  • $\begingroup$ I guess you are talking about this. nature.com/news/… which, I admit is odd. 0 is significantly lower than all except 8. Which seems to contradict that the same digit is least likely as it appears 2 less would be less likely. However that isn't a contradiction because... $\endgroup$ – fleablood May 13 '16 at 16:20
  • $\begingroup$ ... i'm not sure the proper way to express this is statistic vocabulary but summing the likelihoods over the digits isn't the same as summing the likelihoods and distributing them over the digits. Let's say a 1 followed by a 1, 3 by 3, etc. are all the least likely but a 1 followed by a 1 is for less likely than a 3 followed by 3. In fact a 3 followed by a 3 is even more likely than a 1 followed by a 3 which in turn is less likely than a 1 followed by a one. This way each digits gap is least likely to be 0 but the least likely gap overall could by 8. $\endgroup$ – fleablood May 13 '16 at 16:27
  • $\begingroup$ @fleablood there is a numberphile video about this. $\endgroup$ – N.S.JOHN May 13 '16 at 17:31
  • $\begingroup$ I missed the video. With the exception of 8, 0 is significantly less frequent. So the question I guess is why do they note the 0 is least likely when 8 is even less likely. However I think it is possible that for each digit 0 is less likely than 8 but in total 8 is less likely overall. Maybe... I'm having a hard time coming up with such a model. $\endgroup$ – fleablood May 13 '16 at 18:13

There are only three last digits that can lead to a gap of $8$ while there are four that can lead to a gap of $10$. If the last digit of a prime is $7$, a gap of $8$ would lead to a number whose last digit is $5$, which cannot be prime. This suppresses gaps of $8$.


The prime gaps modulo 10 numbers from the table:

$0: 4047130+3896688+3893204+4048329=15885351\\ 2: 6467273+6469289+6950273=19886835\\ 4: 6133642+5557028+5556094=17246764\\ 6: 6526597+6525043+5885706=18937346\\ 8: 4763818+5250387+5251784=15265989\\$

For gap 0 modulo 10 there are four results all others three (because one of the results ends with 5). The average prime gap is about 20 in the range you used, so many gaps are larger than 10. If we look at the gaps modulo 30 we see 26 and 28 have the least possible primes. The loss for 26 is compensated by gap 6 with 6 possibilities.


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.