コード例 #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
コード例 #2
0
def generate_primes(limit):
    return tuple(p for p in takewhile(lambda x: x <= limit, lazy_sieve()))