optimized sieve of eratosthenes