Post Reply 
Little math problem(s) May 2021
05-06-2021, 11:29 PM
Post: #10
RE: Little math problem(s) May 2021
(04-30-2021 08:54 PM)pier4r Wrote:  I wanted to leave one little problem as usual, hopefully it won't be too trivial but neither too overwhelming.

This is one among of the shortest math publications
[Image: shortest-math-paper.jpg]

Anyway they didn't provide the code through which they found the result (although one can suspect they optimized it a bit, despite the CDC6600 being a beast at the time).

Thus the task would be to write a code, for a calculator, that finds the counterexample in an optimized way (as otherwise the search space can blow up), of course aside from hardcoding or nearly hardcoding the counterexample.

----------------

Loved the idea of trying to get it out of the HP41CX. Code below, not particularly optimized (or using any of Albert's ingenious knowledge), gets the solution for 144 in 6 minutes 3 seconds, and that there is no solution for 145 in 13 minutes and 39 seconds. (on the i41CX emulator).

The code uses that the 4 numbers are increasing in size. Starting from the largest possible number to be part of the sequence, and sees if it is possible to find a solution with that. Doing this recursively from 4 to 3 to 2 numbers, stopping whenever it has gone over the threshold or no solution is possible.

Equation to check: a^5 + b^5 + c^5 + d^5 = e^5

Variables:
STO 20 : d^5
STO 21: Trial for d (d_i)
STO 22: max possible d
STO 10 : e^5 - d_i^5
STO 11: trial for c (c_i)
STO 12: max possible c, given d_i
STO 00: e^5 - d_i^5 - c_i^5
STO 01: trial for b (b_i)
STO 02: max possible b, given d_i, c_i

STO 15 : 5 (hp number entry is slow...)
STO 14 : 1/5
STO 03 : 0.000001 (precision of HP 41 arithmetic is not good enough to calculate fifth roots from O(1e10) with sufficient accuracy.

STO 16 : start time
STO 17 : total duration for solution

Flag 0 = solution found
Flag 5 = do not play a tone

Code:

Lbl 'QQQQ
STO 20

STO 15
1/x 
STO 14
0.000001 
STO 03
CF 00
TIME
STO 16
2
RCL 15
Y^x
3
RCL 15
y^x
+
INCX
CHS
RCL 20
+
RCL 14
Y^x
INT
STO 21
STO 22
4
RCL 14
Y^x
ST/ 22
LBL 00
RCL 21
VIEW X
RCL 15
Y^x
CHS
RCL 20
+
XEQ 'QQQ
FS?C 00
GTO'FOUND
RCL 21
DECX
STO 21
RCL 22
X>Y?
GRO 'NF
GTO 00

LBL'FOUND
BEEP
TIME
RCL 16
HMS-
STO 17
CLX
RCL 21
'SOLUTION
AVIEW
STOP
END

LBL 'QQQ
STO 10
DECX
2
RCL 15
Y^x
-
RCL 14
Y^x
INT
STO 11
STO 12
RCL 21
X<Y?
RTN
3
RCL 14
Y^x
ST/ 12
LBL 00
RCL 11
RCL 15
Y^x
CHS
RCL 10
+
XEQ 'QQ
FS?C 00
GTO 'FND
RCL 11
DECX
STO 11
RCL 12
X>Y ?
RTN
GTO 00
LB 'FND
'FOUND QQQ
RCL 11
AVIEW
SF 00
RTN
END

LBL 'QQ
STO 00
DECX
RCL 14
Y^x
INT
STO 01
STO 02
RCL 11
X<Y?
RTN
2
RCL 14
Y^x
ST/ 02
LBL 00
RCL 01
RCL 15
Y^x
CHS
RCL 00
+
RCL 14
Y^x
ENTER
CEIL
-
ABS
RCL 03
X>Y?
GTO 'FF
RCL 01
DECX
STO 01
RCL 02
X>Y?
RTN
GTO 00
LBL 'FF
'FOUND
SF 00
BEEP
RCL 01
AVIEW
RTN

Cheers,

PeterP
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Little math problem(s) May 2021 - pier4r - 04-30-2021, 08:54 PM
RE: Little math problem(s) May 2021 - EdS2 - 05-01-2021, 02:51 PM
RE: Little math problem(s) May 2021 - PeterP - 05-06-2021 11:29 PM



User(s) browsing this thread: 1 Guest(s)