Generating primes using the sieve of eratosthenes