How to resolve the algorithm Euler's sum of powers conjecture step by step in the Fortran 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 Fortran 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 Fortran programming language

Source code in the fortran programming language

C EULER SUM OF POWERS CONJECTURE - FORTRAN IV
C FIND I1,I2,I3,I4,I5 : I1**5+I2**5+I3**5+I4**5=I5**5
      INTEGER I,P5(250),SUMX
      MAXN=250
      DO 1 I=1,MAXN
   1  P5(I)=I**5
      DO 6 I1=1,MAXN
      DO 6 I2=1,MAXN
      DO 6 I3=1,MAXN
      DO 6 I4=1,MAXN	  
      SUMX=P5(I1)+P5(I2)+P5(I3)+P5(I4)
      I5=1
   2  IF(I5-MAXN) 3,3,6
   3  IF(P5(I5)-SUMX) 5,4,6
   4  WRITE(*,300) I1,I2,I3,I4,I5
      STOP
   5  I5=I5+1
      GOTO 2
   6  CONTINUE
 300  FORMAT(5(1X,I3))
      END


program sum_of_powers
  implicit none

  integer, parameter :: maxn = 249      
  integer, parameter :: dprec = selected_real_kind(15)
  integer :: i, x0, x1, x2, x3, y
  real(dprec) :: n(maxn), sumx

  n = (/ (real(i, dprec)**5, i = 1, maxn) /)
 
outer: do x0 = 1, maxn
         do x1 = 1, maxn
           do x2 = 1, maxn
             do x3 = 1, maxn
               sumx = n(x0)+ n(x1)+ n(x2)+ n(x3)
               y = 1
               do while(y <= maxn .and. n(y) <= sumx)
                 if(n(y) == sumx) then
                   write(*,*) x0, x1, x2, x3, y
                   exit outer
                 end if
                 y = y + 1
               end do  
             end do
           end do
         end do
       end do outer
        
end program


  

You may also check:How to resolve the algorithm Evolutionary algorithm step by step in the Prolog programming language
You may also check:How to resolve the algorithm Abbreviations, automatic step by step in the zkl programming language
You may also check:How to resolve the algorithm Pernicious numbers step by step in the Raku programming language
You may also check:How to resolve the algorithm Jensen's Device step by step in the Seed7 programming language
You may also check:How to resolve the algorithm File input/output step by step in the Scala programming language