Count Primes (Sieve of Eratosthenes)

Medium · Math & Number Theory · about 15 minutes

Asked at Amazon, Microsoft, Google.

How many primes are there below n (not counting n itself)?