def sum_of_proper_divisors(number): """Returns the sum of proper divisors of n, optimized with hash""" hash_hit = _hash.get(number) if hash_hit: return hash_hit computed_sum = sum(util.proper_divisors(number)) _hash[number] = computed_sum return computed_sum
def abundant(n): return sum(proper_divisors(n)) > n
from math import sqrt from util import primesfrom2to, product, proper_divisors p = product([int(x) for x in list(primesfrom2to(190))]) print max(filter(lambda x: x < sqrt(p), proper_divisors(p)))
def sum_proper_divisor(n): return sum(util.proper_divisors(n))
def sum_divisors(x): return sum(proper_divisors(x))