May 17, 2016

Horse 2113 - The Last Digit Of Prime Numbers - They Don't Like Repeating Themselves

http://www.nature.com/news/peculiar-pattern-found-in-random-prime-numbers-1.19550
Two mathematicians have found a strange pattern in prime numbers — showing that the numbers are not distributed as randomly as theorists often assume.
Prime numbers near to each other tend to avoid repeating their last digits, the mathematicians say: that is, a prime that ends in 1 is less likely to be followed by another ending in 1 than one might expect from a random sequence.
- Nature, 14th March 2016.

I originally saw this on the cover of Nature magazine in the magazine rack in the library near where I work (each magazine gets its own little cube thing; with the latest copy on the swinging flap) and thought nothing of it.
Okay, so the primes have a tendency not to repeat their last digit. I already knew that there is a weak tendency across all Bases for the there to be a slight bulge in the middle, so in Base-10 there are more primes which end in 3 and 7 rather than 1 and 9, so I didn't consider all of this to be of particular note.

Until I saw this:



Dr James Grime appeared on Brady Haran's Youtube Channel "Numberphile" and ran through this.

Okay, maybe oh maybe it's just a Base-10 thing. You know, Base-10. You know, who cares about Base-10, right? If it was a fundamental property of primes, it would happen in any base... and it does.
That's what they found. So they checked it in other bases and they found the bias is still there, so it appears to be a fundamental property of the primes.
- Dr James Grime, Numberphile, 4th May 2016

A quick refresher:
Firstly, in Base-10, all primes other than 2 (which is the only even prime) and 5, will end in either 1, 3, 7 or 9. Apart from 2 (which itself is prime), all even numbers are divisible by 2 and so all numbers ending in 2, 4, 6, 8 and 0 are not prime. Likewise, because all numbers which end in 5, are an odd multiple of 5.

I should also point out that all primes greater than 3 are in the form P=6k±1,where 6 is a positive integer.
As an example, 99132 which is in between 99131 and 99133 when divided by 6 is 16522. 99138 which is in between 99137 and 99139, is just 6 more and therefore also satisfies P=6k±1.
99131, 99133, 99137 and 99139 are the biggest prime quartet that I could find in a list of the first 10,000 primes
This isn't to say that all (6k±1) are primes, not a bar of it. For instance, 120±1 gives you 119 and 121 and neither of those are primes. However, all primes greater than 3 are in the form of P=6k±1.

You can prove this fact quite easily.
6k is divisible by six.
6k+1 is a candidate
6k+2 is even and therefore not prime.
6k+3 is divisible by 3.
6k+4 is even and therefore not prime.
6k+5 is a candidate
6k+6 is divisible by six and is just the next k.

This also means to say that in Base-6 all primes must end in either 1 or 5 (except for 2 and 3).
By inference, in Base-12 all primes must end in either 1, 5, 7 or E (except for 2 and 3) because odd multiples of 6 end with a 6, and all even multiples of 6 end with a 0.

Getting to one of the main points of this video, the thrust is that consecutive primes have a tendency not to repeat their last digit and they're not sure of the reason why. One of the theories that was shot down was that maybe this was just base-10 thing. If it was a fundamental property of primes, this non-repetition of digits should happen in any base.

The video hints at but doesn't quite nail why a number is prime. The standard definition of a prime is that it is a number which is only divisible by itself and 1. Yet I think that the underlying reason why it is so, is far more important. Every prime is the first positve integer which is not a multiple of the non-unitary integers smaller than it. 0 isn't really a multiple of anything and 1 kind of isn't a 'multiple' either. Every other positive integer is a multiple of 1 and that in a broad sense gives us the 'why' of counting.
There are no non-unitary integers smaller than 2: 2 is prime. 3 is not a multiple of 2: 3 is prime. 4 is a multiple of 2: 4 is not Prime. 5 is not a multiple of 2, 3 or 4: 5 is prime. This will very much like I am telling mathematicians how to suck eggs but I think that it is worth starting right at the beginning before moving forward.
When we start children off in primary school, we give them the number line. This is a very useful tool. There are no multiples of 0. The multiples of 1, define all of the integers and therefore all of the whole numbers on the line. If you start drawing waves under the number line, then every single prime is the first peak on a new wave. The Sieve of Erasthones which is probably derided by serious mathematicians and certainly not the method which is used to find ever larger primes, is basically the working out of this and setting off all the waves on their merry way towards infinity.

There are 16 possible combinations for a prime ending in one number to be followed by another in Base-10; they are thus:
(1,1), (1,3), (1,7), (1,9)
(3,1), (3,3), (3,7), (3,9)
(7,1), (7,3), (7,7), (7,9)
(9,1), (9,3), (9,7), (9,9)
This video showed the statistics of the likelihood of each of these combinations but not what had to be done in order to achieve them.

Remember, all primes bigger than 3 are in the form of P=6k±1. Take the pair of (1,1). There are in fact four possible combinations of 6k you have to work at here.
To illustrate this, consider the pair of primes 31 and 61. In Base-10 they are a (1,1) prime pair. Not only that, they are are pair of primes where the 6k immediately precedes both of them (30 and 60). For convenience sake (and because I don't know what else to call them) paired primes of this form, I am calling a First pair.
There are three more sets of conditions where the primes and 6k values fall in relation to each other. Primes where the two 6k values fall in between them, such as 11 and 31 (the 6ks are 12 and 30), I am calling an Inside pair. Primes where the two 6k values fall outside them, such as 31 and 41 (the 6ks are 30 and 42), I am calling an Outside pair. Likewise, primes where the two 6k values fall in after them, such as 41 and 71 (the 6ks are 42 and 72), I am calling an Last pair.

For the sixteen sets of prime endings, there are four possible sets of 6k values. Every possible set has a First, Inside, Outside and Last set of minimum 6k values which are possible. The minimum distance between the various 6k values can be calculated fairly easily. Those sixty-four values are listed below.

(1,1) 30, 18, 12, 30
(1,3) 12, 0, 24, 12
(1,7) 6, 24, 18, 6
(1,9) 18, 6, 30, 18
(3,1) 18, 6, 30, 18
(3,3) 30, 18, 12, 30
(3,7) 24, 12, 6, 24
(3,9) 6, 24, 18, 6
(7,1) 24, 12, 6,24
(7,3) 6, 24, 18, 6
(7,7) 30, 18, 12, 30
(7,9) 12, 0, 24, 12
(9,1) 12, 0, 24, 12
(9,3) 24, 12, 6, 24
(9,7) 18, 6, 30, 18
(9,9) 30, 18, 12, 30

Even a customary glance at the patterns which the 6k gaps throws up gives you at least something to consider. For each of the repeated digit prime pairs, the First and Last 6k gaps are 30. The Inside prime pairs have a minimum 6k gap of 18 and the Outside prime pairs have a minimum 6k gap of 12.
It should be pointed out that there aren't maximum gaps between various prime pairs and the difference between them will be the minimum 6k gap value plus some multiple of 30. 31 is prime, 61 is primes but 91 is divisible by 7 and 13, and 121 is the square of 11, so we have to wait until 151 for the next number to qualify as a First prime pair.

Bear in mind that in other bases, say Base-12, the last digits of the primes will change. 31 and 61 which are a First prime pair will always be a First prime pair but in Base-12 for instance, they cease to be a (1,1) pair and will become a (7,1) pair.
In other bases, the primes themselves won't change and neither will the 6k gaps between them but the last digits we will concerned about will and therefore a new set of 6k gaps will need to be calculated.
The contention though, is that primes don't like to repeat their last digit and this is true for all bases. This means to say that all we are concerned with, is looking for the last digits of the last two primes. This also means to say that in Base-10 at least, we are looking for prime gaps of 30 for a First and Last pair, 18 for an Inside pair or 12 for an Outside pair at the minimum and multiples of 30 before another prime comes along.
For a (9,1) pair the 6k values which sit between them can be 0; that is, that they are the same 6k. An example of this is the number 30 where it sits between 29 and 31. This is also true for 71 and 73 where the 6k which sits between them is 72. Inside 6k values also exist for a (7,9) pair like 17 and 19 where the 6k value is 18.

What I suspect is going on, is that the minimum prime gaps are the biggest determinant of what  that next prime is going to be. That will of course express itself differently in other bases. What I also suspect is going on is that each new prime and indeed each new integer sets off its own series of waves that echo through and onto infinity. If primes are the first peak of their own new wave, then you're most likely to find primes at points where the most waves converge. What I don't know is if the primes themselves have any bearing on k because as far as I can tell, if k is prime then 6k±1 is also a good candidate to also be prime.

If the non repetition of the last digit of primes is a fundamental property of primes, then I'm wondering if the primes themselves are also some determinant in their own properties. That might explain why this happens in all bases.
I think that this is the key to understand why primes have a tendency not to repeat; even though I can't prove this mathematically, as I don't have either the skills or the tools.

No comments: