# -*- coding: utf-8 -*-# 要求:用python方法找出1000以内的所有完数,并输出。def f(n): list = [] for i in range(2, n + 1): for j in range(2, i / 2): if i % j == 0 and j <= (i / j): list.append(j) list.append(i / j) if sum(list) + 1 == i: print i list = [] if __name__=="__main__": n=int(raw_input("请输入最大范围:")) f(n)