Skip to content

Instantly share code, notes, and snippets.

@cklein
Created September 28, 2012 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cklein/3800064 to your computer and use it in GitHub Desktop.
Save cklein/3800064 to your computer and use it in GitHub Desktop.
Sum of 4th powers
numbers = {}
for i in range(1, 200):
for j in range(1, 200):
number = i ** 4 + j ** 4
numbers.setdefault(number, set()).add(tuple(sorted((i, j))))
print min(dict((number, pairs) for number, pairs in numbers.items() if len(pairs) > 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment