How does Sieve work? #SumAllPrimes

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… :frowning:


1 Like

This may help: Do read both responses. :slight_smile: