Count Primes

Easy
Math Math Sieve

Count the number of prime numbers less than n.

Constraints

0 ≤ n ≤ 5×10^6

Examples

Example 1:
Input: 10
Output: 4
Explanation: Primes: 2,3,5,7
Example 2:
Input: 0
Output: 0
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.