To run this, just do:
python 6prime.py
Do note that the current limit is set pretty high, and might take a few hours to compute. If you would like to change that,
change the lmt
variable to something more suitable.
Letting this run over night, then going to compare the results to the prime number theorem approximation.
It's the morning, still not finished the calculations. Almost done though. Let me make some predictions based on the prime number theory.
The prime number theorem for arithmetic progressions states that a progression a, a + n, a + 2n, a + 3n, … less than x, has approximately:
π(x) = (1/ϕ(n))Li(x)
primes. Which in this case is about:
π(x) = 2((1/2)Li(6000000))
= 413076.504
prime numbers (multiplied by 2 as I tested both -1 and 1 for a). Let's see how the results compare.
Well this was definitely underwhelming. Only 375341 numbers were prime. So much for a increased distribution of primes around 6x ± 1.
I did however, notice a few interesting things. Firstly, the gap between primes increased dramatically as the value
of 6 * inv
got larger. There were significant swabs of text where I would see 6-7 non-primes in a row. Remember, these
are multiples of 6 ± 1, so I did not expect such large gaps of nothing. Also why is this not apparent in the lower numbers?
Almost all of the primes between 1 - 100 can accurately be identified using the 6x ± 1 method... Interesting.