Exemple #1
0
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
Exemple #3
0
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)))
Exemple #4
0
def sum_proper_divisor(n):
    return sum(util.proper_divisors(n))
def sum_divisors(x):
    return sum(proper_divisors(x))