For n∈N+n \in \mathbb{N}^+, let π(n)\pi(n) be the number of prime numbers that are ≤n\le n. The prime number theory states that

lim⁡nπ(n)ln⁡nn=1. \lim_{n} \pi(n) \frac{\ln n}{n} = 1.

We show here a weaker version in which

π(n)n=Θ(1log⁡n). \frac{\pi(n)}{ n } = \Theta \left( \frac{1}{ \log n } \right).

It states that the density of the prime numbers in [1,n][1, n] is Θ(1/log⁡2n)\Theta(1 / \log_2 n), which is inversely proportional to the number of bits required to represent nn.

Theorem. For 3≤n∈N+3 \le n \in \mathbb{N}^+, it holds that

12log⁡2n≤π(n)n≤2ln⁡n \frac{1}{2 \log_2 n} \le \frac{\pi(n)}{n} \le \frac{2}{\ln n}

For the first inequality, we will show that ∀k∈[n]\forall k \in [n],

(nk)≤nπ(n). \binom{n}{ k } \le n^{ \pi(n) }.

Roughly speaking, the prime factorization of (nk)\binom{n}{k} consists of at most π(n)\pi(n) different primes ≤n\le n. The inequality follows if we can prove that the highest power of a prime in the factorization is at most nn. We can choose k=⌊n/2⌋k = \lfloor n / 2 \rfloor to maximize the lower bound.

For the second inequality, we use

(k+2)π(2k+1)−π(k+1)≤(2k+1k) (k + 2)^{ \pi(2k + 1) - \pi(k + 1) } \le \binom{ 2k + 1}{ k }

for k∈N+k \in \mathbb{N}^+ and upper bound (2k+1k)\binom{ 2k + 1}{ k } by 22k2^{2k}. We only consider odd numbers 2k+12k + 1 here because π(2k+2)=π(2k+1),∀k∈N+\pi(2k + 2) = \pi(2k + 1), \forall k \in \mathbb{N}^+.

Proof of The Theorem, Part 1.

We need a few lemmas for the proof.

Definition. Given a prime number pp and n∈N+n \in \mathbb{N}^+, mp(n)m_p(n) is the number of large integer kk such that pkp^k divides nn.

Lemma 1.

mp(n!)=∑j=1∞⌊npj⌋ m_p(n!) = \sum_{j = 1}^\infty \left\lfloor \frac{n}{p^j} \right\rfloor

Proof. We count the number of time pp divides n!n!. Each multiple of pp that is in [n][n] contributes a factor. Each multiple of p2p^2 that is in [n][n] contributes another factor, and so on.

□\square

Lemma 2.

Let a,b∈N+a, b \in \mathbb{N}^+, a>b>0a > b > 0. Given a prime pp and an integer k∈N+k \in \mathbb{N}^+, if pkp^k divided (ab)\binom{a}{b}, then pk≤ap^k \le a.

Proof. Let k′=mp((ab))k' = m_p(\binom{a}{b}). It suffices to show that pk′≤ap^{k'} \le a.

k′=mp(a!b!(a−b)!)=mp(a!)−mp(b!)−mp((a−b)!)=∑j=1∞(⌊apj⌋−⌊bpj⌋−⌊b−apj⌋) \begin{aligned} k' &= m_p \left( \frac{a!}{b! (a - b)!} \right) \\ &= m_p(a!) - m_p(b!) - m_p( (a - b)! ) \\ &= \sum_{j = 1}^\infty \left( \left \lfloor \frac{a}{p^j} \right\rfloor - \left\lfloor \frac{b}{p^j} \right\rfloor - \left\lfloor \frac{b - a}{p^j} \right\rfloor \right) \end{aligned}

Each summand is either 1 or 0. Further, when pj>ap^j > a (i.e., j>log⁡paj > \log_p a), the summand is 0. It concludes that k′≤log⁡pak' \le \log_p a.

□\square

Lemma 3.

(n⌊n/2⌋)≤nπ(n) \binom{n}{ \lfloor n / 2 \rfloor} \le n^{ \pi(n) }

Proof. Consider the unique prime factorization of (n⌊n/2⌋)\binom{n }{ \lfloor n / 2 \rfloor},

(n⌊n/2⌋)=p1k1p2k2...ptkt, \binom{n}{ \lfloor n / 2 \rfloor } = p_1^{k_1} p_2^{k_2} ... p_t^{k_t},

where pi≠pjp_i \neq p_j, for 1≤i<j≤t1 \le i < j \le t. By Lemma 2 we have ∀i∈[t]\forall i \in [t], piki≤np_i^{k_i} \le n and pip_i is a prime number at most nn. Hence t≤π(n)t \le \pi(n). It follows that

(n⌊n/2⌋)=p1k1p2k2...ptkt≤nt≤nπ(n). \binom{n}{ \lfloor n / 2 \rfloor } = p_1^{k_1} p_2^{k_2} ... p_t^{k_t} \le n^t \le n^{ \pi(n) }.

□\square

Lemma 4.

1n+12n≤(n⌊n/2⌋)≤nπ(n) \frac{1}{n + 1} 2^{n} \le \binom{n}{ \lfloor n / 2 \rfloor } \le n^{\pi(n)}

Proof. Given n∈N+n \in \mathbb{N}^+, as (nk)\binom{n}{k} is maximized when k=⌊n/2⌋k = \lfloor n / 2 \rfloor for (k=0,1,2,...,nk =0, 1, 2, ..., n), it holds that

1=(12+12)n≤(n+1)12n(n⌊n/2⌋). 1 = \left( \frac{1}{2} + \frac{1}{2} \right)^n \le (n + 1) \frac{1}{2^n} \binom{n}{ \lfloor n / 2 \rfloor }.

This establishes the lower bound.

□\square

By Lemma 4,

π(n)≥n−log⁡(n+1)log⁡n≥12nlog⁡n. \pi(n) \ge \frac{n - \log (n + 1) }{\log n} \ge \frac{1}{2} \frac{n}{\log n}.

The final inequality holds when log⁡(n+1)≤0.5n\log (n + 1) \le 0.5 n. It suffices to take n≥7n \ge 7, as log⁡(7+1)=3<3.5\log (7 + 1) = 3 < 3.5 but log⁡(3+1)=2>1.5\log (3 + 1) = 2 > 1.5. When n<7n < 7, we can check manually that π(n)/n≥0.5/log⁡n\pi(n) / n \ge 0.5 / \log n holds.

■\blacksquare

Proof of The Theorem, Part 2.

Lemma 5.

For k∈N+k \in \mathbb{N}^+,

(2k+1k)≥∏k+2≤p≤2k+1∧p is primep \binom{2k + 1}{ k } \ge \prod_{k + 2 \le p \le 2k + 1 \wedge p \text{ is prime}} p

Proof. First,

(2k+1k)=(2k+1)(2k)(2k−1)...(k+2)k(k−1)...1. \binom{2k + 1}{k} = \frac{(2k + 1) (2k) (2k - 1) ... (k + 2)}{ k (k - 1) ... 1}.

For a prime p∈[k+2,2k+1]p \in [k + 2, 2k + 1], it divides the numerator but not the denominator.

□\square

We prove that π(n)≤2n/ln⁡n\pi(n) \le 2 n / \ln n by induction. When n>2n > 2 is even, π(n)=π(n−1)\pi(n) = \pi(n - 1). As 2n/ln⁡n2 n / \ln n increases with nn, it suffices to prove this for odd numbers of nn. Suppose that n=2k+1n = 2k + 1 for some k∈N+k \in \mathbb{N}^+, then

(k+2)π(2k+1)−π(k+1)≤∏k+2≤p≤2k+1∧p is primep≤(2k+1k). (k + 2)^{\pi(2k + 1) - \pi(k + 1) } \le \prod_{k + 2 \le p \le 2k + 1 \wedge p \text{ is prime}} p \le \binom{2k + 1}{k}.

Further

(2k+1k)=12((2k+1k)+(2k+1k+1))≤12⋅22k+1=22k. \binom{2k + 1}{k} = \frac{1}{2} \left( \binom{2k + 1}{k} + \binom{2k + 1}{k + 1}\right) \le \frac{1}{2} \cdot 2^{2k + 1} = 2^{2k}.

Therefore,

π(2k+1)−π(k+1)≤2k⋅ln⁡2ln⁡(k+2). \pi(2k + 1) - \pi(k + 1) \le \frac{ 2k \cdot \ln 2 }{ \ln (k + 2)}.

By induction on π(k+1)\pi(k + 1), we arrive at

π(2k+1)≤2k⋅ln⁡2ln⁡(k+2)+2k+1ln⁡(k+1)<(n−1)⋅ln⁡2+n+1ln⁡(k+1)<(1+ln⁡2)⋅n+1ln⁡(n/2). \pi(2k + 1) \le \frac{ 2k \cdot \ln 2 }{ \ln (k + 2)} + 2 \frac{ k + 1}{\ln (k + 1)} < \frac{ (n - 1) \cdot \ln 2 + n + 1 }{\ln (k + 1) } < \frac{ (1 + \ln 2) \cdot n + 1}{\ln (n / 2) }.

In order that

(1+ln⁡2)⋅n+1ln⁡(n/2)≤2nln⁡n, \frac{ (1 + \ln 2) \cdot n + 1}{\ln (n / 2) } \le \frac{2 n }{ \ln n},

we need

(1+ln⁡2)⋅n⋅ln⁡n+ln⁡n≤2n⋅ln⁡n−2n⋅ln⁡2⟺(2ln⁡2)⋅n+ln⁡n≤(1−ln⁡2)⋅n⋅ln⁡n. (1 + \ln 2) \cdot n \cdot \ln n + \ln n \le 2 n \cdot \ln n - 2 n \cdot \ln 2 \\ \Longleftrightarrow (2 \ln 2) \cdot n + \ln n \le (1 - \ln 2) \cdot n \cdot \ln n.

This holds when n≥107n \ge 107. It is left to verify manually that π≤2n/ln⁡n\pi \le 2 n / \ln n holds for all n<107n < 107.

Reference

[1] Jan-Hendrik, "Chapter 1: Introduction to prime number theory", ANALYTIC NUMBER THEORY