Skip to content

Prime Counting Function

One of the oldest questions in number theory asks how prime numbers are distributed among the positive integers. Since primes become less frequent as numbers grow larger,...

Counting Prime Numbers

One of the oldest questions in number theory asks how prime numbers are distributed among the positive integers. Since primes become less frequent as numbers grow larger, mathematicians seek functions that measure their density.

The central object is the prime counting function

π(x), \pi(x),

defined by

π(x)=#{px:p is prime}. \pi(x)=\#\{p\leq x : p \text{ is prime}\}.

Thus π(x)\pi(x) counts the number of primes not exceeding xx.

For example,

π(10)=4, \pi(10)=4,

since the primes not exceeding 1010 are

2,3,5,7. 2,3,5,7.

Similarly,

π(30)=10. \pi(30)=10.

The behavior of π(x)\pi(x) for large xx is one of the central themes of analytic number theory.

Early Observations

The first values of π(x)\pi(x) suggest that primes become rarer as numbers increase:

xxπ(x)\pi(x)
101044
1001002525
10001000168168
100001000012291229

Although primes continue indefinitely, their density decreases. Roughly speaking, the probability that a large integer near xx is prime is approximately

1logx. \frac1{\log x}.

This heuristic eventually leads to the Prime Number Theorem.

Step Function Structure

The function π(x)\pi(x) is a step function. It remains constant on intervals containing no primes and jumps by 11 at each prime number.

For example,

π(x)=4 \pi(x)=4

for all

7x<11, 7\leq x<11,

because no primes lie strictly between 77 and 1111.

The graph therefore has discontinuities exactly at the primes.

Elementary Bounds

A first problem is to estimate the size of π(x)\pi(x). Euclid proved that infinitely many primes exist, which implies

π(x) \pi(x)\to\infty

as xx\to\infty.

However, Euclid’s proof gives little quantitative information about growth.

Simple arguments show that

π(x)x. \pi(x)\leq x.

A better estimate comes from observing that all primes greater than 22 are odd, giving approximately

π(x)x2. \pi(x)\lesssim \frac{x}{2}.

Stronger bounds require deeper methods.

Logarithmic Heuristics

Suppose one asks for the probability that a large integer nn is prime. Divisibility considerations suggest:

  • probability not divisible by 22: 1/21/2,
  • probability not divisible by 33: 2/32/3,
  • probability not divisible by 55: 4/54/5,

and so forth.

Assuming rough independence leads formally to the product

px(11p). \prod_{p\leq x}\left(1-\frac1p\right).

Euler showed that this product behaves approximately like

1logx. \frac1{\log x}.

This suggests that primes near xx occur with density roughly 1/logx1/\log x. Consequently,

π(x)xlogx. \pi(x)\approx \frac{x}{\log x}.

Although this argument is heuristic, it predicts the correct asymptotic order.

The Logarithmic Integral

A more accurate approximation is obtained from the logarithmic integral

li(x)=2xdtlogt. \operatorname{li}(x) = \int_2^x \frac{dt}{\log t}.

This function accumulates the local density 1/logt1/\log t across the interval from 22 to xx.

The logarithmic integral approximates π(x)\pi(x) remarkably well. For example,

xxπ(x)\pi(x)li(x)\operatorname{li}(x)
10210^2252530.130.1
10310^3168168177.6177.6
10410^4122912291246.11246.1

The approximation improves relative to xx as xx increases.

Asymptotic Notation

To describe large-scale behavior precisely, analytic number theory uses asymptotic notation.

One writes

f(x)g(x) f(x)\sim g(x)

if

limxf(x)g(x)=1. \lim_{x\to\infty}\frac{f(x)}{g(x)}=1.

Thus the statement

π(x)xlogx \pi(x)\sim \frac{x}{\log x}

means that the ratio of the two functions approaches 11 as xx\to\infty.

This is the content of the Prime Number Theorem, proved independently by Hadamard and de la Vallée Poussin in 1896.

Arithmetic Significance

The prime counting function measures the global distribution of primes. Many deeper questions refine its behavior:

  • How large can prime gaps become?
  • How often do primes occur in arithmetic progressions?
  • How accurately does li(x)\operatorname{li}(x) approximate π(x)\pi(x)?
  • How irregular is the error term
π(x)li(x)? \pi(x)-\operatorname{li}(x)?

These questions connect directly with the zeros of the Riemann zeta function and the analytic structure of LL-functions.

The study of π(x)\pi(x) therefore lies at the center of analytic number theory.