Created
January 27, 2015 04:22
-
-
Save pqcfox/59ffebf1aa2728a5c642 to your computer and use it in GitHub Desktop.
An exercise in my Number Theory class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input("Enter a number: ")) | |
def perfect(n): | |
total = 0 | |
for k in range(1, n): | |
if n % k == 0: total += k | |
return total == n | |
message = 'yes' if perfect(n) else 'no' | |
print(message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment