标签:
代码:
#!/usr/bin/env python # encoding: utf-8 """ @author: 侠之大者kamil @file: 3.完全数.py @time: 2016/3/21 18:02 """ n = 24 # for i in range(1,n): # if n % i ==0: # print(i) def isperfectNumber(n): a = 1 b = n s = 0 while a < b: if n % a ==0: s += a + b a += 1 b = n/a if a ==b and a*b == n: s +=a return s - n == n for k in range(2,10000): if isperfectNumber(k): print(k) def func(): pass class Main(): def __init__(self): pass if __name__ == ‘__main__‘: pass
标签:
原文地址:http://www.cnblogs.com/kamil/p/5303139.html