I have a few posts about implementing the sieve of Eratosthenes efficiently:

Optimizing the Sieve of Eratosthenes

One problem using the raw sieving technique is that the sieve asks the question...