Skip to content

Instantly share code, notes, and snippets.

@qalle2
Created October 9, 2023 01:50
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 qalle2/8d0a830a4470c05cd61363e399e21044 to your computer and use it in GitHub Desktop.
Save qalle2/8d0a830a4470c05cd61363e399e21044 to your computer and use it in GitHub Desktop.
The fifth power of 72
A Python program that proves a = 72 is the smallest solution to
a^5 = b^5 + c^5 + d^5 + e^5 + f^5 where a...f are positive integers.
Prints 72 (19, 43, 46, 47, 67).
import itertools
for base in range(1, 72 + 1):
for comb in itertools.combinations_with_replacement(range(1, base), 5):
if sum(b ** 5 for b in comb) == base ** 5:
print(base, comb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment