The density of the n-bit primes #
For every n > 1, at least a 1 / (3 n) fraction of the n-bit numbers, those in
[2 ^ (n - 1), 2 ^ n), are prime. This is Theorem 9.32 of [KL20], which the book
states without proof. It is what makes the random prime generator of Algorithm 9.34 succeed with
high probability.
For n ≥ 13 the proof follows Erdős's proof of Bertrand's postulate. Write m = 2 ^ (n - 1).
Erdős's upper bound on the central binomial coefficient C(2 m, m) in terms of the number K of
primes in [m, 2 m) (Nat.centralBinom_le_pow_card_primes_Ico, in
CslibFrontier/Foundations/NumberTheory/CentralBinomPrimes.lean) gives
C(2 m, m) ≤ (2 m) ^ √(2 m) 4 ^ (2 m / 3) (2 m) ^ K. Comparing with 4 ^ m < m C(2 m, m) bounds
K from below. The cases 1 < n < 13 are checked against explicit lists of primes.
Main results #
Nat.two_pow_sub_one_le_three_mul_card_primes: for1 < n, the number of primes in[2 ^ (n - 1), 2 ^ n)is at least2 ^ (n - 1) / (3 n).
References #
The density of the n-bit primes ([KL20], Theorem 9.32): for 1 < n, at
least a 1 / (3 n) fraction of the numbers in [2 ^ (n - 1), 2 ^ n) are prime.