Exemple #1
0
def eul12(n):
    """What is the value of the first triangle number to have over n = five hundred divisors?"""
    total = 1
    curr = 2
    while len(eul.get_factors(total)) < n:
        total += curr
        curr += 1
    return total
Exemple #2
0
import eul
sieve = eul.sieve_array(100000000)
total = 0
for n in range(2, 100000000, 2):
    prime = True
    for d in eul.get_factors(n):
        if not sieve[d + n/d]:
            prime = False
            break
    if prime:
        total += n
        print(n, total)