## The last digits of triples of consecutive primes

I found last week’s news about patterns in last digits of consecutive primes to be really interesting. Here’s Evelyn Lamb’s piece about the new paper:

Peculiar Pattern Found in “Random” Prime Numbers

Although the main results in the paper are way over my head, I thought it would be fun to try to understand the results a bit more. I decided to look at the last digits (in base 10) of triples of consecutive primes. Mathematica makes this task pretty simple since there is a function Prime[i] which tells you the $i^{th}$ prime number.

I was surprised by some of the patterns.

Looking at the primes from 11 until the prime number 100,000,000 (that’s 2,038,074,743 if you are interested!) I found these results in the last digits of triples of consecutive primes:

(1,1,1) occurs 752,992 times, and
(9,9,9) occurs 752,902 times.

(3,3,3) occurs 737,172 times, and
(7,7,7) occurs 735,435 times.

and for the most frequently occurring patterns:

(9,1,7) occurs 2,429,154 times, and
(3,9,1) occurs 2,429,802 times.

(the full list is at the bottom of the page)

I was amazed at how close the counts were, so I ran the same code again, but this time went up to prime number 1,000,000,000 (which is 22,801,763,489) and found similar results:

(1,1,1) occurs 8,143,311 times, and
(9,9,9) occurs 8,139,168 times.

(3,3,3) occurs 8,013,553 times, and
(7,7,7) occurs 8,006,387 times.

and, again, for the most frequently occurring patterns:

(9,1,7) occurs 23,285,442 times, and
(3,9,1) occurs 23,285,599 times.

I’m surprised both by (i) how different counts for various triples are from either other, and by (ii) how similar certain pairs of counts are to each other.

Can’t wait to see what results end up following from last week’s paper. It certainly has been a fun couple of years for prime numbers!

Here’s my count for the triples occurring between 11 and prime number 100,000,000:

(1 , 1 , 1) = 752,991

(1 , 1 , 3) = 1,473,963

(1 , 1 , 7) = 1,338,238

(1 , 1 , 9) = 1,057,849

(1 , 3 , 1) = 1,605,399

(1 , 3 , 3) = 1,424,130

(1 , 3 , 7) = 2,139,275

(1 , 3 , 9) = 2,260,634

(1 , 7 , 1) = 1,829,358

(1 , 7 , 3) = 2,085,911

(1 , 7 , 7) = 1,330,194

(1 , 7 , 9) = 2,259,149

(1 , 9 , 1) = 1,606,073

(1 , 9 , 3) = 1,474,440

(1 , 9 , 7) = 1,304,421

(1 , 9 , 9) = 1,057,410

(3 , 1 , 1) = 1,152,478

(3 , 1 , 3) = 1,637,164

(3 , 1 , 7) = 1,916,059

(3 , 1 , 9) = 1,305,280

(3 , 3 , 1) = 1,121,750

(3 , 3 , 3) = 737,172

(3 , 3 , 7) = 1,253,949

(3 , 3 , 9) = 1,329,690

(3 , 7 , 1) = 1,830,430

(3 , 7 , 3) = 1,817,402

(3 , 7 , 7) = 1,253,361

(3 , 7 , 9) = 2,142,502

(3 , 9 , 1) = 2,429,892

(3 , 9 , 3) = 1,819,555

(3 , 9 , 7) = 1,916,051

(3 , 9 , 9) = 1,337,398

(7 , 1 , 1) = 1,123,346

(7 , 1 , 3) = 1,954,359

(7 , 1 , 7) = 1,821,161

(7 , 1 , 9) = 1,475,115

(7 , 3 , 1) = 1,660,559

(7 , 3 , 3) = 1,190,879

(7 , 3 , 7) = 1,818,700

(7 , 3 , 9) = 2,085,057

(7 , 7 , 1) = 1,089,299

(7 , 7 , 3) = 1,191,047

(7 , 7 , 7) = 735,435

(7 , 7 , 9) = 1,423,574

(7 , 9 , 1) = 2,362,556

(7 , 9 , 3) = 1,955,794

(7 , 9 , 7) = 1,638,318

(7 , 9 , 9) = 1,475,202

(9 , 1 , 1) = 1,594,226

(9 , 1 , 3) = 2,363,951

(9 , 1 , 7) = 2,429,154

(9 , 1 , 9) = 1,604,100

(9 , 3 , 1) = 1,623,274

(9 , 3 , 3) = 1,090,380

(9 , 3 , 7) = 1,831,771

(9 , 3 , 9) = 1,827,515

(9 , 7 , 1) = 1,624,894

(9 , 7 , 3) = 1,660,835

(9 , 7 , 7) = 1,120,365

(9 , 7 , 9) = 1,606,645

(9 , 9 , 1) = 1,592,910

(9 , 9 , 3) = 1,123,151

(9 , 9 , 7) = 1,153,949

(9 , 9 , 9) = 752,906