src/cool_primes/sieves.py
def erat(n):
    """
    A fixed-size version of Sieve of Eratosthenes.

    Returns a list of primes up to n inclusive.
    """
    if n < 2:
        return []
    arr = list(range(n + 1))
    arr[0] = arr[1] = None
    i = 2
    while i * i <= n:
        # Cross out all multiples of i starting from i**2
        for p in range(i * i, n + 1, i):
            arr[p] = None
        i += 1
        while i <= n and arr[i] is None:
            i += 1

    return list(filter(None, arr))

    A fixed-size version of Sieve of Eratosthenes.

    Returns a list of primes up to n inclusive.
    
A fixed-size version of Sieve of Eratosthenes.
Returns a list of primes up to n inclusive.
A fixed - size version of Sieve of Eratosthenes . Returns a list of primes up to n inclusive .
def erat(n):
    if n < 2:
        return []
    arr = list(range(n + 1))
    arr[0] = arr[1] = None
    i = 2
    while i * i <= n:
        for p in range(i * i, n + 1, i):
            arr[p] = None
        i += 1
        while i <= n and arr[i] is None:
            i += 1
    return list(filter(None, arr))
def erat ( n ) : if n < 2 : return [ ] arr = list ( range ( n + 1 ) ) arr [ 0 ] = arr [ 1 ] = None i = 2 while i * i <= n : for p in range ( i * i , n + 1 , i ) : arr [ p ] = None i += 1 while i <= n and arr [ i ] is None : i += 1 return list ( filter ( None , arr ) )
A fixed-size version of Sieve of Eratosthenes.
A fixed - size version of Sieve of Eratosthenes .
"""
    A fixed-size version of Sieve of Eratosthenes.

    Returns a list of primes up to n inclusive.
    """ # Cross out all multiples of i starting from i**2
n