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()))
