Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # -*- coding: utf-8 -*-
- def is_perfect(n):
- if n < 2:
- return False
- measure = []
- for i in xrange(1, n / 2 + 1):
- if n % i == 0:
- measure.append(i)
- return n == sum(measure)
- if __name__ == "__main__":
- for i in range(0, 1000):
- if is_perfect(i):
- print i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement