Counting primes using Sieve of Eratosthenes