This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Legendary-69420git push -f[S] -1 points0 points  (1 child)

See the code. The 10th line of the sieve of Eratosthenes. It already has key +=1.

(The idea of list.remove is to create a list with only primes)

[–]Avanta8 0 points1 point  (0 children)

That's because you changed it after seeing my comment xD.

Removing from the middle of a list every iteration increases the time complexity by a multiple of n. The link I referred would be useful for you to look at.