/* Program to count frequencies of last digits of prime numbers for Jonathan Leaf This reproduces (and extends) the values found in: Unexpected biases in the distribution of consecutive primes Robert J. Lemke Oliver and Kannan Soundararajan https://doi.org/10.1073/pnas.1605366113 https://www.pnas.org/doi/10.1073/pnas.1605366113 */ num = 100 million d = new dict lastPrime = 7 startPrime = nextPrime[lastPrime] for p = first[primes[startPrime], num] { d.increment[[lastPrime mod 10, p mod 10]] lastPrime = p } println[formatTable[lexicalSort[d]]]