Пример #1
0
def solve():
    factors = 0
    z = 0
    while factors < 250:    # 250 pairs of factors = 500 factors
        z += 1
        factors = len(find_factors(triangle_number(z)))
    print triangle_number(z)
Пример #2
0
def find_prime_factorization(number):
    all_factors = find_factors(number)
    prime_factorization = []
    if len(all_factors) == 1:
        prime_factorization.extend([x for x in all_factors[0]])
    else:
        all_factors.remove((1, number))
        factor_pair = all_factors.pop()

        for f in factor_pair:
            if is_prime(f):
                prime_factorization.append(f)
            elif f not in (1, number):
                map(lambda x: prime_factorization.append(x), find_prime_factors(f))
    return prime_factorization