Example #1
0
def count_factors(n):
    prime_factors = find_prime_factors(n)
    factors = set(prime_factors)
    new_factors = [set_product(x) for x in powerset(prime_factors)]
    factors = factors.union(new_factors)
    count = len(factors)
    if n not in factors:
        count += 1 # add one for the number itself if it was not prime
    return count
Example #2
0
#find the largest prime factor of 600851475143

import math
from projecteuler import find_prime_factors

number = 600851475143

pf = find_prime_factors(number)

print(pf[-1])