(n)
return result
Return a list of the primes below n.
Return a list of the primes below n.
Return a list of the primes below n .
def sieve5(n):
    """Return a list of the primes below n."""
    """from http://codereview.stackexchange.com/questions/42420/sieve-of-eratosthenes-python"""
    prime = [True] * n
    result = [2]
    append = result.append
    sqrt_n = (int(n ** .5) + 1) | 1    # ensure it's odd
    for p in range(3, sqrt_n, 2):
        if prime[p]:
            append(p)
            prime[p*p::2*p] = [False] * ((n - p*p - 1) // (2*p) + 1)
    for p in range(sqrt_n, n, 2):
        if prime[p]:
            append(p)
    return result
def sieve5 ( n ) : """from http://codereview.stackexchange.com/questions/42420/sieve-of-eratosthenes-python""" prime = [ True ] * n result = [ 2 ] append = result . append sqrt_n = ( int ( n ** .5 ) + 1 ) | 1 # ensure it's odd for p in range ( 3 , sqrt_n , 2 ) : if prime [ p ] : append ( p ) prime [ p * p : : 2 * p ] = [ False ] * ( ( n - p * p - 1 ) // ( 2 * p ) + 1 ) for p in range ( sqrt_n , n , 2 ) : if prime [ p ] : append ( p ) return result