How to resolve the algorithm Euler's sum of powers conjecture step by step in the Forth programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Euler's sum of powers conjecture step by step in the Forth programming language

Table of Contents

Problem Statement

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. This conjecture is called Euler's sum of powers conjecture and can be stated as such: 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. The task consists in writing a program to search for an integer solution of

x

0

5

x

1

5

x

2

5

x

3

5

=

y

5

{\displaystyle x_{0}^{5}+x_{1}^{5}+x_{2}^{5}+x_{3}^{5}=y^{5}}

where all

x

i

{\displaystyle x_{i}}

and

y

{\displaystyle y}

are distinct integers between 0 and 250 (exclusive). Show an answer here. Related tasks are:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Euler's sum of powers conjecture step by step in the Forth programming language

Source code in the forth programming language

: sq  dup * ;
: 5^  dup sq sq * ;

create pow5 250 cells allot
:noname
   250 0 DO  i 5^  pow5 i cells + !  LOOP ; execute

: @5^  cells pow5 + @ ;

: solution? ( n -- n )
   pow5 250 cells bounds DO
      dup i @ = IF  drop i pow5 - cell / unloop EXIT  THEN
   cell +LOOP drop 0 ;
 
\ GFORTH only provides 2 index variables: i, j
\ so the code creates locals for two outer loop vars, k & l

: euler  ( -- )
   250 4 DO i { l }
      l 3 DO i { k }
         k 2 DO
            i 1 DO
               i @5^ j @5^ + k @5^ + l @5^ + solution?
               dup IF
                  l . k . j . i . . cr
                  unloop unloop unloop unloop EXIT
               ELSE
                  drop
               THEN
            LOOP
         LOOP
      LOOP
   LOOP ;

euler
bye


  

You may also check:How to resolve the algorithm A+B step by step in the Fish programming language
You may also check:How to resolve the algorithm Sieve of Eratosthenes step by step in the Scala programming language
You may also check:How to resolve the algorithm Remove lines from a file step by step in the NewLISP programming language
You may also check:How to resolve the algorithm Peano curve step by step in the Fōrmulæ programming language
You may also check:How to resolve the algorithm Phrase reversals step by step in the MiniScript programming language