Sieve of Eratosthenes
def sieve ( ) : NEW_LINE INDENT primes [ 0 ] = primes [ 1 ] = 0 NEW_LINE i = 2 NEW_LINE while i * i <= maxn : NEW_LINE INDENT if ( primes [ i ] ) : NEW_LINE INDENT for j in range ( i * i , maxn + 1 , i ) : NEW_LINE INDENT primes [ j ] = False NEW_LINE DEDENT DEDENT i += 1 NEW_LINE DEDENT DEDENT