Post Reply 
Programming puzzle: Longest list of regular numbers?
04-19-2017, 03:09 PM (This post was last modified: 04-19-2017 03:27 PM by Claudio L..)
Post: #29
RE: Programming puzzle: Longest list of regular numbers?
(04-18-2017 10:36 PM)Claudio L. Wrote:  
(04-18-2017 10:09 PM)Claudio L. Wrote:  14999 ==> newRPL: 94.8 seconds, the result is 2305843009213693952 = 2^61

I suspect something wrong, the result is the same after iteration 11562 = 2.304e18. All results after that are = 2^61. I need to study the algorithm and what's happening at this iteration so scratch that result off for now.



Fixed! There was a bug in newRPL's == operator which was fixed. For those who want to try Han's code, I uploaded a ROM with the fix (to the usual download location).
It also implements MIN and MAX, which to my surprise were not yet implemented (it was an oversight, they were listed under the wrong category in the command database).
I've attached here Han's code with the proper Unicode characters. The actual sequence to get it in the calc is:
put the text on the SD card (hanprog.txt), then do (on the stack):

Code:

"hanprog.txt" SDOPENRD    @ This opens the file and returns a handle number
DUP SDFILESIZE                 @ Get the size of the file
OVER SDREADTEXT           @ Read the entire file as a string
SWAP SDCLOSE                  @ Close the file
STR->                                    @ Compile the program

Now the corrected benchmark results:

14999 --> 113.57 seconds, result is 1.236950581248E20
The slowdown versus the previous report is due to the change from 64-bit integers to variable precision reals after iteration 11563. The bug I fixed never let the result go over 2^63 hence computations were faster. I'll update the original post with the right timings.


Attached File(s)
.txt  hanprog.txt (Size: 400 bytes / Downloads: 6)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Programming puzzle: Longest list of regular numbers? - Claudio L. - 04-19-2017 03:09 PM



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