Write π(n) for the number of primes up to n. The Prime Number Theorem says π(n) grows like n/ln(n). As n gets larger, about 1 in every ln(n) numbers near n is prime. Near one million, roughly 1 in 14 numbers is prime. Near one billion, 1 in 21.
The blue step function jumps by 1 at each prime (2, 3, 5, 7, 11…). The red dashed curve n/ln(n) runs slightly below. Their ratio approaches 1 as n → ∞. By n=50, π(50)=15 and 50/ln(50)≈12.8.
Gauss conjectured the result around 1800 after studying prime tables. It was proved independently in 1896 by Jacques Hadamard and Charles-Jean de la Vallée Poussin, both using the Riemann zeta function and complex analysis. A purely elementary proof (without complex analysis) was found independently by Selberg and Erdős in 1948.
The Riemann Hypothesis would give the sharpest bound on the error: |π(n) - Li(n)| ≤ √n · ln(n) / (8π). Without it, we only know the error is o(n/ln(n)). This is why the Riemann Hypothesis is mathematics' most important open problem: it would tell us exactly how predictable prime gaps are.
A more accurate approximation to pi(n) than n/ln(n) is the logarithmic integral Li(n) = integral from 2 to n of dt/ln(t). Gauss preferred this form. For n = 1,000,000: n/ln(n) gives 72,382 while Li(n) gives 78,628, versus the exact count of 78,498. The error of Li(n) is far smaller. The Riemann Hypothesis would bound this error precisely at sqrt(n) * ln(n).