@@ -0,0 +1,1639 @@
+%22%22%22%0AA perfect number is a number for which the sum of its proper divisors is exactly%0Aequal to the number. For example, the sum of the proper divisors of 28 would be%0A1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.%0A%0AA number n is called deficient if the sum of its proper divisors is less than n%0Aand it is called abundant if this sum exceeds n.%0A%0AAs 12 is the smallest abundant number, 1 + 2 + 3 + 4 + 6 = 16, the smallest%0Anumber that can be written as the sum of two abundant numbers is 24. By%0Amathematical analysis, it can be shown that all integers greater than 28123%0Acan be written as the sum of two abundant numbers. However, this upper limit%0Acannot be reduced any further by analysis even though it is known that the%0Agreatest number that cannot be expressed as the sum of two abundant numbers%0Ais less than this limit.%0A%0AFind the sum of all the positive integers which cannot be written as the sum%0Aof two abundant numbers.%0A%22%22%22%0A%0Adef solution(limit = 28123):%0A    %22%22%22%0A    Finds the sum of all the positive integers which cannot be written as%0A    the sum of two abundant numbers%0A    as described by the statement above.%0A%0A    %3E%3E%3E solution()%0A    4179871%0A    %22%22%22%0A    sumDivs = %5B1%5D * (limit + 1)%0A%0A    for i in range(2, int(limit ** 0.5) + 1):%0A        sumDivs%5Bi * i%5D += i%0A        for k in range(i + 1, limit // i + 1):%0A            sumDivs%5Bk * i%5D += k + i%0A%0A    abundants = set()%0A    res = 0%0A%0A    for n in range(1, limit + 1):%0A        if sumDivs%5Bn%5D %3E n:%0A            abundants.add(n)%0A%0A        if not any((n - a in abundants) for a in abundants):%0A            res+=n%0A%0A    return res%0A%0A%0Aif __name__ == %22__main__%22:%0A    print(solution())%0A

Add problem 23 solution (#1261)