Marking Odds as Primes and then selectively Not Primes

In Lecture : Prime Sieve of Eratosthenes

First, we’re iterating on all odd numbers and marking them initially as primes ie. 1. (i+=2 in line=25)
Then, from(Line=30) we’re iterating again on all odd numbers, and marking all multiples of
each odd number being iterated on, as not prime ie. 0.

Sir, Why are we checking if it is already marked prime (1) (Line=32)? Because all odd numbers are already
marked prime ie. 1.

@Sneha.SNC.007 it’s possible that you marked some odd numbers as non-prime as well, for example you iterate over multiples of 3 and mark 9 as not Prime. So now you needn’t iterate over multiples of 9,because they’d have been marked as well.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.