def sieve(limit):
    """
    Returns a list of prime numbers up to but not including the given number.
    """
    array = [True] * limit                          
    array[0] = array[1] = False
    primes = []
    for (number, prime) in enumerate(array):
        if prime:
            primes.append(number)
            for index in range(number * number, limit, number):
                array[index] = False
    return primes