# How does Sieve work? #SumAllPrimes

How does Sieve work? #SumAllPrimes
0

#1

I am trying to understand the ‘basic’ solution but I don’t understand how the Sieve gets filled (I do see that in other solutions though). This is how I read the if statement within the for loop:

“If the i’th number within sieve is not there, push this number to primes”

But… ‘sieve’ is empty the way I regard it?

…and then there is a for loop that quickly follows that I really don’t understand…

Thanks!!!

#2

This may help: https://stackoverflow.com/questions/17265218/can-you-explain-this-method-of-finding-prime-numbers-in-javascript. Do read both responses.