Beispiel #1
0
Datei: p02x.py Projekt: jpaeng/PE
def amicable_list(max_n):
    """ Return the list of amicable numbers up to max_n."""
    am_list = []
    for n in range(2, max_n+1):
        divisor_sum = sum(common.get_proper_divisors(n))
        if divisor_sum > n:
            if n == sum(common.get_proper_divisors(divisor_sum)):
                am_list.append(n)
                am_list.append(divisor_sum)
    return am_list
Beispiel #2
0
Datei: p02x.py Projekt: jpaeng/PE
def abundant_list(max_n):
    """ Return list of abundant numbers up to max_n."""
    alist = [n for n in range(2, max_n+1) if n < sum(common.get_proper_divisors(n))]
    return alist