Ejemplo n.º 1
0
def f(n):
    """sindle-digit ms to compute for 600851475143"""
    pg = primes()
    d = n
    p = next(pg)
    while d > p**2:
        if d % p == 0:
            d = d // p
        else:
            p = next(pg)
    return d
Ejemplo n.º 2
0
from eulermath import is_prime, get_list_of_prime_numbers, primes
import time

limit = input("What is the limit you want to calculate primes to:")
t0 = time.time()
sum = 0
for i in primes(limit):
    sum += i
t1 = time.time()

print "The sum of the primes up to", limit, "is:", sum
print t1 - t0
Ejemplo n.º 3
0
def f(n):
    """hundreds of ms. Good enough for now."""
    pg = primes()
    p = itertools.islice(pg, n-1, n)
    return next(p)