Skip to content

Instantly share code, notes, and snippets.

@pqcfox
Created January 27, 2015 04:22
Show Gist options
  • Save pqcfox/59ffebf1aa2728a5c642 to your computer and use it in GitHub Desktop.
Save pqcfox/59ffebf1aa2728a5c642 to your computer and use it in GitHub Desktop.
An exercise in my Number Theory class.
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