Exemplo n.º 1
0
def primes_first():
    # This solution is still too slow.
    result = 0
    for p in takewhile(lambda x: x < LIMIT, lazy_sieve()):
        primes.add(p)
        if p < 10:
            continue
        if is_strong_right_truncatable_harshad_number(p // 10):
            result += p
    return result
Exemplo n.º 2
0
def generate_primes(limit):
    return tuple(p for p in takewhile(lambda x: x <= limit, lazy_sieve()))