Prime-counting function

The prime-counting function, written π(x), gives the number of prime numbers less than or equal to a real number x. Its values record how primes are distributed among the integers. The prime number theorem says that, for large x, π(x) is asymptotic to x divided by the natural logarithm of x, providing a simple estimate of how prime numbers become less dense as numbers grow.

Last updated
22 October 2026
Confidence
High (98%)
Sources
4
Versions
1
This article was researched and drafted with AI assistance and checked by an automated review pass. It is not guaranteed to be accurate — verify important facts against the references below.

Definition and examples

For a real number x, π(x) denotes the number of primes p satisfying p ≤ x. The symbol π here names a function; it is not the circle constant. For example, the primes no greater than 10 are 2, 3, 5 and 7, so π(10) = 4. Since the count changes only when x reaches a prime, π(x) is a step function: it remains constant between successive primes and increases by one at each prime.

The prime number theorem

The prime number theorem describes the broad growth of π(x). In asymptotic notation, π(x) ~ x / ln(x) as x grows without bound; equivalently, the ratio of π(x) to x / ln(x) tends to 1. Thus x / ln(x) becomes a relatively accurate estimate of the count for sufficiently large x, even though it is not an exact formula. The theorem expresses the gradual thinning of prime numbers among larger integers: near a large value x, the rough density of primes is about 1 / ln(x).

History of the estimate and proof

In the late eighteenth century, Adrien-Marie Legendre proposed an approximation for the number of primes, and Carl Friedrich Gauss independently developed an insight into their distribution. Gauss later related prime counting to the logarithmic integral, a generally sharper approximation than x / ln(x). The prime number theorem was eventually proved independently in 1896 by Jacques Hadamard and Charles-Jean de la Vallée Poussin. Their proof established a precise limiting relationship, rather than merely a numerical pattern suggested by tables.

Uses and limits

The function is central to analytic number theory because it turns the question “how many primes are there up to x?” into an object that can be studied and estimated. The prime number theorem gives large-scale average behaviour, not the location of each next prime or an exact count at a particular input. For any finite x, π(x) can in principle be found by counting primes up to x; estimates are useful when direct counting is impractical. More refined approximations, including those involving the logarithmic integral, can improve on the leading estimate in many ranges.

Key facts

Notation
π(x) counts primes less than or equal to x.
Example
π(10) = 4, because 2, 3, 5 and 7 are the primes no greater than 10.
Prime number theorem
π(x) is asymptotic to x / ln(x) as x tends to infinity.
Meaning of the estimate
The ratio π(x) / (x / ln(x)) tends to 1; x / ln(x) is an estimate, not an exact identity.
First proof
Hadamard and de la Vallée Poussin independently proved the theorem in 1896.

Ask about this article

Answers use only “Prime-counting function” and its references, with citations.

References

  1. 1.
    Prime Counting Function

    Wolfram MathWorld · other · reliability: high · retrieved 22 October 2026

    Supports: Defines π(x) as the number of primes less than or equal to x.

  2. 2.
    Prime Number Theorem

    Wolfram MathWorld · other · reliability: high · retrieved 22 October 2026

    Supports: Explains the asymptotic estimate for prime counting, historical estimates, and the independent 1896 proofs.

  3. 3.
    prime number theorem

    Encyclopaedia Britannica · encyclopedia · reliability: high · retrieved 22 October 2026

    Supports: Overview of the theorem, its historical development, and its relation to estimates for the distribution of primes.

  4. 4.
    Primes: Distribution of the primes

    American Mathematical Society · other · reliability: high · retrieved 22 October 2026

    Supports: Introductory account of the prime-counting function, Legendre and Gauss's estimates, and the prime number theorem.

References are suggested by the research engine and may be incomplete. Unverified URLs are omitted rather than guessed.

Article history

  1. Version 122 October 2026 · EditorCreated by Zapia