def solve(): abundant_numbers = [] for num in xrange(28123 + 1): #print num divisors = proper_divisors(num) if sum(divisors) > num: abundant_numbers.append(num) answer = set(xrange(28123 + 1)) for i, x in enumerate(abundant_numbers): for n in abundant_numbers[i:]: if n+x > 28123: break if n + x in answer: answer.remove(n+x) print sum(answer)
def test_proper_divisors_284(self): self.assertEqual(p021.proper_divisors(284), [1, 2, 4, 71, 142])
def test_proper_divisors_220(self): self.assertEqual(p021.proper_divisors(220), [1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110])