示例#1
0
文件: p02x.py 项目: 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
示例#2
0
文件: p02x.py 项目: 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