# Prime Counting Function

## 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

$$
\pi(x),
$$

defined by

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

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

For example,

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

since the primes not exceeding $10$ are

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

Similarly,

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

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

## Early Observations

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

| $x$ | $\pi(x)$ |
|---|---|
| $10$ | $4$ |
| $100$ | $25$ |
| $1000$ | $168$ |
| $10000$ | $1229$ |

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

$$
\frac1{\log x}.
$$

This heuristic eventually leads to the Prime Number Theorem.

## Step Function Structure

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

For example,

$$
\pi(x)=4
$$

for all

$$
7\leq x<11,
$$

because no primes lie strictly between $7$ and $11$.

The graph therefore has discontinuities exactly at the primes.

## Elementary Bounds

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

$$
\pi(x)\to\infty
$$

as $x\to\infty$.

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

Simple arguments show that

$$
\pi(x)\leq x.
$$

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

$$
\pi(x)\lesssim \frac{x}{2}.
$$

Stronger bounds require deeper methods.

## Logarithmic Heuristics

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

- probability not divisible by $2$: $1/2$,
- probability not divisible by $3$: $2/3$,
- probability not divisible by $5$: $4/5$,

and so forth.

Assuming rough independence leads formally to the product

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

Euler showed that this product behaves approximately like

$$
\frac1{\log x}.
$$

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

$$
\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

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

This function accumulates the local density $1/\log t$ across the interval from $2$ to $x$.

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

| $x$ | $\pi(x)$ | $\operatorname{li}(x)$ |
|---|---|---|
| $10^2$ | $25$ | $30.1$ |
| $10^3$ | $168$ | $177.6$ |
| $10^4$ | $1229$ | $1246.1$ |

The approximation improves relative to $x$ as $x$ increases.

## Asymptotic Notation

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

One writes

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

if

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

Thus the statement

$$
\pi(x)\sim \frac{x}{\log x}
$$

means that the ratio of the two functions approaches $1$ as $x\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 $\operatorname{li}(x)$ approximate $\pi(x)$?
- How irregular is the error term

$$
\pi(x)-\operatorname{li}(x)?
$$

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

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

