Number System

Prime-Counting Function

A student counts highlighted stones along a row of wooden tiles.

Prime-Counting Function definition

The prime-counting function π(x) gives the number of primes less than or equal to x.

In Spanish
función contadora de primos
Topic
Prime numbers and number theory

Prime-Counting Function in a picture

Prime-Counting Function diagramThe primes at most 12 are 2, 3, 5, 7, and 11, so π(12) = 5.Set the upper limit: 12Include every prime at most 12List the primes: 2, 3, 5, 7, 11Count only prime numbersπ(12) = 5There are five primes in the list
The primes at most 12 are 2, 3, 5, 7, and 11, so π(12) = 5.

How it works

Count each prime once, starting with 2. The value stays constant between prime inputs and increases by one at each prime. The symbol π here names the counting function, with x as its input.

Worked examples

Find π(10).

The primes are 2, 3, 5, and 7. The count is 4.

Find π(11) − π(10).

11 is prime, so the count increases by 1.

Find π(2.5).

2 is the only prime at most 2.5, so the count is 1.

Common mistake

The definition includes the endpoint if it is prime. Count 11 when finding π(11).

Quick check

What is π(6)?

What is π(1)?

Show answer

0.

What happens to π(x) at x = 7?

Show answer

It increases by one because 7 is prime.

Sources

Flashcard

Prime-Counting Function

Reveal the definition

The prime-counting function π(x) gives the number of primes less than or equal to x.

Effortless Math. “Prime-Counting Function.” Math Dictionary.