17 1000以内的完数(经典)

1 for x in range(1,1001):
2     factor = []
3     for i in range(1,x):
4         if x%i == 0:
5             factor.append(i)
6     if sum(factor) == x:
7         print(x)

 

posted @ 2020-04-10 07:48  不着魔,不成佛  阅读(140)  评论(0编辑  收藏  举报