IntermediateRating 1200
Count Primes Fast
Count the primes up to n using the Sieve of Eratosthenes.
Input
One integer n (1 ≤ n ≤ 2·10⁶).
Output
A count.
Sample 1
Input
10
Output
4
Sample 2
Input
1
Output
0
Output appears hereOne integer n (1 ≤ n ≤ 2·10⁶).
A count.
10
4
1
0
Output appears here