Update all multiples of p greater than or equal to the square of it numbers which are multiple of p and are less than p ^ 2 are already been marked .
for i in range ( p * p , N , p ) : NEW_LINE INDENT isprime [ i ] = False ; NEW_LINE DEDENT primes = [ ] ; NEW_LINE for i in range ( 2 , N ) : NEW_LINE if ( isprime [ i ] ) : NEW_LINE primes . append ( i ) ; NEW_LINE return primes ; NEW_LINE