euler/python/e021.py

16 lines
325 B
Python
Raw Normal View History

2019-07-16 04:11:49 +02:00
from lib_misc import sum_proper_divisors
def euler_021():
t = 0
for n in range(1, 10000):
s = sum_proper_divisors(n)
if n != s and n == sum_proper_divisors(s):
t += n
return t
if __name__ == "__main__":
assert(euler_021() == 31626)
print("e021.py: {}".format(euler_021()))