Example #1
0
def triangle_num_factors(f):
    """ Find the first triangle number with at least f factors.
    
    """

    n = 1
    i = 2
    while n < 100000000:
        n += i
        if not n % 60:
            if len(euler.all_factors(n)) > f:
                return n
        i += 1
Example #2
0
File: 23.py Project: higgsd/euler
# 4179871
import euler
N = 28123
ab = []
for n in xrange(12, N+1):
    if sum(euler.all_factors(n)[:-1]) > n:
        ab.append(n)
abab = [n for n in xrange(N+1)]
for a in ab:
    for b in ab:
        if a + b > N:
            break
        abab[a+b] = 0
print sum(abab)
Example #3
0
File: 21.py Project: higgsd/euler
# 31626
import euler
N = 10000
s = 0
for a in xrange(2,N):
    b = sum(euler.all_factors(a)[:-1])
    db = sum(euler.all_factors(b)[:-1])
    if a != b and a == db:
        s += a
print s