New answers tagged

1

Agreed, this is not the Sieve of Eratosthenes. This is trial division by primes. (As long as you're doing trial division, you can do it slightly better, and only test up to the square root of the number.) Replace the while loop, making it clearer and more pythonic: for test in num_list: It is inefficient to delete from the middle of a list in python, which ...


0

"Purist" in me says that any solution which is not starting with building finite table of numbers is not sieve of Eratosthenes, as well as any solutions which don't keep all information (numbers, cross-offs) in one table (datastructure). Why? Back in Eratosthenes days he had to create table, after he finished creating table he started crossing off ...


Top 50 recent answers are included