Exemplo n.º 1
0
def amicable_pair(num):
    """
    Determines if num is amicable and returns its copair element if it is
    :param num:
    :return: 0 if num is not amicable, num's copair element if it is
    """
    copair = sum(factor.divisors(num)) - num
    return copair if (sum(factor.divisors(copair)) - copair) == num and copair != num else 0
Exemplo n.º 2
0
def abundant_numbers(limit):
    """
    Find all abundant numbers less than a given limit
    :param limit: Cutoff for list
    :return: (list) Abundant numbers from 1 to limit
    """

    return [x for x in xrange(1, limit) if sum(divisors(x)) > 2 * x]