The last digits of twin primes

I spent the last few weeks playing around with the last digits of 3 consecutive primes. It was a fun project inspired by this new discovery about primes that Evelyn Lamb discusses here:

Peculiar Pattern Found in “Random” Prime Numbers

The data about the distribution of the last digits of three consecutive primes is in this spreadsheet:

My prime triple counting data

My next project involves looking at the distribution of the last digits of twin primes. The first result doesn’t seem that surprising – the last digits (1,3), (7,9) and (9,1) for twin primes seem to occur with roughly the same frequency:

Twin primes with last digit (a,b) occur this many times in the first billion and 2nd billion primes

(1,3) occurs 19,349,298 times and 18,144,757 times,
(7,9) occurs 18,349,510 times and 18,143,078 times, and
(9,1) occurs 19,348,370 times and 18,145,486 times.

Again, not really a surprise. The next thing I’ve started to look at is twin prime pairs – so when twin primes with last digits (1,3) occur, what are the last digits of the next twin primes?

[April 3, 2016 note. Dave Radcliffe pointed out to me that I had the order backwards:

I’m actually surprised that the code worked at all given that the counts were flipped from how I intended to write them, but thanks to Dave for noticing that the counts were flipped ]

Here are the results in the first 10 million primes:

(1,3) is followed by (1,3) 76,109 times
(1,3) is followed by (7,9) 88,965 times
(1,3) is followed by (9,1) 81,374 times

(7,9) is followed by (1,3) 82,139 times
(7,9) is followed by (7,9) 75,825 times
(7,9) is followed by (9,1) 88,438 times

(9,1) is followed by (1,3) 88,200 times
(9,1) is followed by (7,9) 81,612 times
(9,1) is followed by (9,1) 75,933 times

In the first billion primes the numbers were

(1,3) is followed by (1,3) 6,101,617 times
(1,3) is followed by (7,9) 6,798,862 times
(1,3) is followed by (9,1) 6,448,819 times

(7,9) is followed by (1,3) 6,475,915 times
(7,9) is followed by (7,9) 6,105,438 times
(7,9) is followed by (9,1) 6,768,157 times

(9,1) is followed by (1,3) 6,771,766 times
(9,1) is followed by (7,9) 6,445,210 times
(9,1) is followed by (9,1) 6,131,394 times

In the 2nd billion primes the numbers were:

(1,3) is followed by (1,3) 5,752,468 times
(1,3) is followed by (7,9) 6,340,717 times
(1,3) is followed by (9,1) 6,051,573 times

(7,9) is followed by (1,3) 6,071,883 times
(7,9) is followed by (7,9) 5,756,302 times
(7,9) is followed by (9,1) 6,314,893 times

(9,1) is followed by (1,3) 6,320,406 times
(9,1) is followed by (7,9) 6,046,059 times
(9,1) is followed by (9,1) 5,779,020 times

So, similar to the last digits of the prime numbers, consecutive sets of twin primes do not all occur with the same frequency.

I’ve given no thought at all to what I’d expect the distribution to look like, but I’m interested to see what the results look like for the first few billion primes and see what the results look like.



2 Comments so far. Leave a comment below.
  1. for your (1,3) data, I think you mean “(1,3) is followed by (9,1) 88,200 times” not
    “(1,3) is followed by (1,3) 88,200 times”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: