In the article Mathematicians Discover Prime Conspiracy essentially is described the discovery that the last digit of the next prime number is less likely to equal the last digit of its predecessor.

To check this I decided to download a list of the first million prime numbers from here and check.

In [27]:

```
from collections import defaultdict
this2previous = defaultdict(int)
previous = None
with open('primes1.txt') as f:
# Skip text file header
print(f.readline())
for line in f:
line = line.strip()
if not line:
continue
for primelastdigit in (prime[-1] for prime in line.split()):
if previous is not None:
this2previous[(primelastdigit, previous)] += 1
previous = primelastdigit
```

In [28]:

```
def pretty_print(counts):
lastdigit = None
for (this, previous), count in sorted(counts.items()):
if this in '25' or previous in '25':
continue
if lastdigit != this:
print()
lastdigit = this
print('%2s %s after %s frequency: %6i'
% (('#' if this == previous else ''), this, previous, count))
```

In [29]:

```
pretty_print(this2previous)
```

## No comments:

## Post a Comment