Euler's sum of powers conjecture

Revision as of 06:53, 14 April 2015 by rosettacode>Paddy3118 (New draft task and Python solution.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

There is a conjecture in mathematics that held for over 200 years before it was disproved by the finding of a counterexample in 1966 by Lander and Parkin.

Euler's sum of powers conjecture is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Euler's (disproved) sum of powers conjecture
At least k positive kth powers are required to sum to a kth power, except for the trivial case of one kth power: yk = yk.

Lander and Parkin are kmown to have used a brute-force search on a CDC600 computer restricting numbers to those less than 250.

Task

Write a program to search for an integer solutions to:

x0**5 + x1**5 + x2**5 + x3**5 == y**5

Where all x's and y are distinct integers between 0 and 250 (exclusive).

Show an answer here.

Python

<lang python>def eulers_sum_of_powers():

   max_n = 250
   pow_5 = [n**5 for n in range(max_n)]
   pow5_to_n = {n**5: n for n in range(max_n)}
   for x0 in range(1, max_n):
       for x1 in range(1, x0):
           for x2 in range(1, x1):
               for x3 in range(1, x2):
                   pow_5_sum = sum(pow_5[i] for i in (x0, x1, x2, x3))
                   if pow_5_sum in pow5_to_n:
                       y = pow5_to_n[pow_5_sum]
                       return (x0, x1, x2, x3, y)

print("%i**5 + %i**5 + %i**5 + %i**5 == %i**5" % eulers_sum_of_powers())</lang>

Output:
133**5 + 110**5 + 84**5 + 27**5 == 144**5