A8 · The graveyardNo leak
Twin primes: clustering without location
are over-represented exactly as predicts. Trying them first beats counting up, but so does any arbitrary subset of the same size, so twins are not the reason.
The idea
clump more than random numbers would: the formula predicts how many there are, and the count matches. But it says nothing about where one particular p sits. A search that tries twin primes first helps only when p happens to be one, which for ordinary keys is about one time in five. It can still look better than counting up, so the page races it against an arbitrary subset of the same size to see whether twins are the reason.
Watch it
Both searches know p has 20 bits and start at 2¹⁹. Plain trial division tries the primes in order; “twins first” tries the twin primes in order, then the rest.
The test
Twin counts at 10³ … 10⁷ against the formula. Then average divisions for plain order, twins first and an equal-size arbitrary subset first, on honest keys and on a generator that always picks a twin.
Fig. A8.2Twin prime pairs below x: counted on a sieve, against the Hardy–Littlewood prediction
Measuring…