Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def divisors(num):
- div = 1
- amount = 0
- while (div <= num):
- if (num % div == 0):
- amount = amount + div
- div = div + 1
- return amount
- x = 1
- perfect_number= 0
- while (perfect_number < 3):
- result = divisors(x)
- if (result == x * 2):
- print x, "is a perfect number"
- perfect_number = perfect_number + 1
- x = x + 1
Advertisement
Add Comment
Please, Sign In to add comment