def sum_proper_divisors(num): ''' Returns the sum of the proper divisors ''' factors = list(prime_factors(num,prime_list)) total = 0 primes = map(lambda x: x[0] , factors) expons = map(lambda x: x[1] , factors) for expon_list in product( *map(lambda x: range(x+1), expons) ): if list(expon_list) != expons: total += reduce( mul ,map( lambda x, y : x**y , primes, expon_list), 1) return total
def is_abundant(x): if x in prime_set: return False factors = list(prime_factors(x, prime_list)) primes = map(lambda x: x[0], factors) expons = map(lambda x: x[1], factors) sum = 0 for p in product(*map(lambda x: range(x + 1), expons)): if expons != list(p): sum += reduce(mul, map(lambda x, y: x ** y, primes, p), 1) return sum > x
def is_abundant(x): if x in prime_set: return False factors = list(prime_factors(x, prime_list)) primes = map(lambda x: x[0], factors) expons = map(lambda x: x[1], factors) sum = 0 for p in product(*map(lambda x: range(x + 1), expons)): if expons != list(p): sum += reduce(mul, map(lambda x, y: x**y, primes, p), 1) return sum > x
def test_4(num): if len(prime_factors(num)) > 3: return True return False
def main(): return max(prime_factors(600851475143))
from eulertools import prime_factors print(max(prime_factors(600851475143)))