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. 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:
Cheers, PeterP |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Little math problem(s) May 2021 - pier4r - 04-30-2021, 08:54 PM
RE: Little math problem(s) May 2021 - Valentin Albillo - 04-30-2021, 10:49 PM
RE: Little math problem(s) May 2021 - pier4r - 05-01-2021, 07:34 AM
RE: Little math problem(s) May 2021 - EdS2 - 05-01-2021, 02:51 PM
RE: Little math problem(s) May 2021 - Albert Chan - 05-01-2021, 03:12 PM
RE: Little math problem(s) May 2021 - PeterP - 05-03-2021, 10:19 PM
RE: Little math problem(s) May 2021 - Albert Chan - 05-04-2021, 04:33 AM
RE: Little math problem(s) May 2021 - PeterP - 05-04-2021, 09:34 AM
RE: Little math problem(s) May 2021 - pier4r - 05-04-2021, 06:26 PM
RE: Little math problem(s) May 2021 - PeterP - 05-06-2021 11:29 PM
|
User(s) browsing this thread: 4 Guest(s)