In a Google Play mobile performance utility, you need a fast way to answer a simple math-based query: given an integer n, return how many prime numbers are strictly less than n.
A prime number is an integer greater than 1 with exactly two positive divisors: 1 and itself.
n[0, n)Example 1
n = 10410 are 2, 3, 5, 7.Example 2
n = 000, so there are no primes.Example 3
n = 202 is not counted because the range is strictly less than n.0 <= n <= 5 * 10^6n