You are viewing a single comment's thread. Return to all comments →
You may use wheel factorization and the divisor function. It is a bit tricky, but the resulting code is not too much complicated (just two cycles). Implementing the sieve, you have not to test if the divisor is actually prime.