num = 2
while num < 1000:
perfectFactor = 0
n = 1
while n < num:
if num % n == 0:
perfectFactor += n
n += 1
if perfectFactor == num:
print("%d是完数且小于1000." % perfectFactor)
num += 1
num = 2
while num < 1000:
perfectFactor = 0
n = 1
while n < num:
if num % n == 0:
perfectFactor += n
n += 1
if perfectFactor == num:
print("%d是完数且小于1000." % perfectFactor)
num += 1