Maths WorkshopMaths problems with full solutions
Exercise 1140Number theory › PrimesL1Added 3 Nov 2026

The prime counting function

#prime counting#pi function#estimates

Statement

Compute π(30)\pi(30) where π(x)\pi(x) is the number of primes ≤x\le x.

Hint

Use the sieve of Eratosthenes.

Show solutionHide solution

Solution

Primes up to 30. 2,3,5,7,11,13,17,19,23,292,3,5,7,11,13,17,19,23,29.

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

Comparison. The prime number theorem gives π(x)∼x/ln⁡x\pi(x)\sim x/\ln x; at x=30x=30, 30/ln⁡30≈8.830/\ln30\approx8.8, close to 1010.

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