Пример #1
0
def f(n):
    """10s of microseconds to compute for 20"""
    prod = 1
    prime_divs = primes_less(n)
    for a in range(2, n + 1):
        if prod % a == 0:
            continue
        else:
            prod *= least_prime_div(a, prime_divs)
    return prod
Пример #2
0
def f(n):
    """Several seconds :("""
    return sum(primes_less(n))
Пример #3
0
def find_pairs(N):
    ps = primes_less(N+1)
    return [(a, b) for b in ps for a in range(-b, N+1)]