The density of the primes near , denoted , is the proportion of integers in a small window around that are prime. For large this quantity is remarkably well approximated by
That is, an integer chosen uniformly in a neighbourhood of is prime with probability . The primes thin out — but slowly, since grows slowly.
Heuristic derivation: two estimates of
The idea (as in zetamath's videoFactorials, prime numbers, and the Riemann Hypothesis) is to estimate twice — once arithmetically using primes, once analytically using calculus — and force the answers to agree.
1. Via primes (number theory)
The exponent of a prime in is given by Legendre's formula:
Bounding the floors, , so . Taking logarithms of :
2. Via calculus (analytic)
, which is a Riemann sum for the integral of :
3. Equating both estimates
Since both expressions approximate the same , they must be close:
4. Differentiating both sides
Viewing as a continuous variable, the left side is a step function: when increases by we either add (if is prime) or add nothing. Its "average slope" is therefore
where is the proportion of the time we add a full term. The derivative of the right side is . Equating: