Count Primes
Count Primes
Return the number of prime numbers strictly less than n.
Function signature
func CountPrimes(n int) int
Example
n = 10
output = 4 // 2,3,5,7
Constraints
- 0 <= n <= 5_000_000
Notes
- Use the Sieve of Eratosthenes.
Run tests to see results
No issues detected