### Search

 Search WWW Search DelphiForFun.org

As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.

Support DFF - Shop

If you shop at Amazon anyway,  consider using this link.

We receive a few cents from each purchase.  Thanks

### Support DFF - Donate

If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa® Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

(Hint: If you can wait, current year calendars are usually on sale in January.)

### Contact

 Search DelphiForFun.org only

### Problem Description

This program investigates Euler's Sum of Powers Conjecture looking especially for counterexamples which prove the conjecture untrue.

### Background & Techniques

#### In the 18th century, mathematician Leonhard Euler conjectured that if the sum of the kth powers of two or more positive integers is itself the kth power of a positive integer, then the number of terms must be at least k. For example, the sum of 2 cubes can not be a cube but thee cubes can be, the sum of two or three 4th powers cannot be a 4th power, but four 4th powers can be,  etc. It turns out that the conjecture is not true. There exists three 4th powers which sum to a 4th power and four 5th powers which sum to a 5th power! This program will find the smallest counterexample of the 5th power case in a few seconds using a direct search with the initial program defaults. The 4th power counterexample has values too large to be found by this method. The jury is still out on whether the conjecture is true for 6th and higher powers since no counterexamples have been found. The current program can find many examples of two or more squared terms which sum to a square. These are the "Pythagorean Triples" you learned about in high school. Euler's Conjecture is an extension of "Fermat's Last Theorem" which says that there are no solutions to an + bn = cn for any n>2. I believe that it has also been proven that there are no two cubes which sum to a cube but we can quickly generate many examples with 3 cubes summing to a cube. Run time problems begin with the higher powers even though we check several million terms per second. The first four term 4th power sum is found in 140 seconds and the first five term 5th power sum takes 1240 seconds (5.5 billion terms checked!). The next program version will try to confirm the 4th term counterexample by incorporating the more efficient Lander-Parkin Algorithm described in a paper at http://www.ams.org/journals/mcom/1967-21-097/S0025-5718-1967- 0220669-3/S0025-5718-1967-0220669-3.pdf

Non-programmers are welcome to read on, but may want to skip to the bottom of this page to download executable version of the program.

### Notes for Programmers

For efficiency the search is driven with a table containing the specified power values of the specified maximum value to be searched. This makes generating variable candidates very fast, the Nth power of N is located at Table[n].  Checking whether a sum is also in the table is slower, the program currently searches sequentially from the highest final root variable index + 1 until we reach the end of the table or a table entry greater than or equal to the sum being checked.   If the entry is equal, we have a solution.