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



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 



In 1966,   Leon J. Lander   and   Thomas R. Parkin   used a brute-force search on a   CDC 6600   computer restricting numbers to those less than 250.



Task

Write a program to search for an integer solution for:


  x05 + x15 + x25 + x35 == y5 

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

Show an answer here.



Related tasks

   Pythagorean quadruples. 
   Pythagorean triples.


 
EnableExplicit
 
; assumes an array of non-decreasing positive integers
Procedure.q BinarySearch(Array a.q(1), Target.q)
  Protected l = 0, r = ArraySize(a()), m
  Repeat
    If l > r : ProcedureReturn 0 : EndIf; no match found
    m = (l + r) / 2
    If a(m) < target
      l = m + 1
    ElseIf a(m) > target
      r = m - 1
    Else
      ProcedureReturn m ; match found
    EndIf  
  ForEver
EndProcedure
 
Define i, x0, x1, x2, x3, y
Define.q sum
Define Dim p5.q(249)
 
For i = 1 To 249
  p5(i) = i * i * i * i * i
Next
 
If OpenConsole()
  For x0 = 1 To 249
    For x1 = 1 To x0 - 1
      For x2 = 1 To x1 - 1 
        For x3 = 1 To x2 - 1 
          sum = p5(x0) + p5(x1) + p5(x2) + p5(x3)
          y = BinarySearch(p5(), sum)
          If y > 0          
            PrintN(Str(x0) + "^5 + " + Str(x1) + "^5 + " + Str(x2) + "^5 + " + Str(x3) + "^5 = " + Str(y) + "^5")
            Goto finish
          EndIf
        Next x3
      Next x2
    Next x1
  Next x0
 
  PrintN("No solution was found")
  finish:
  PrintN("")
  PrintN("Press any key to close the console")
  Repeat: Delay(10) : Until Inkey() <> ""
  CloseConsole()
EndIf
 