## 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.
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}