Puzzle - RPL and others
|
04-24-2021, 04:40 PM
(This post was last modified: 04-24-2021 05:47 PM by C.Ret.)
Post: #11
|
|||
|
|||
RE: Puzzle - RPL and others
Here a version for HP-28C/S RPL Advanced Scientific Calculator;
As previous proposed code, it is based on a recursive approach, using the stack to store intermediate data. Code: NTST: Usage: Initiate the research by entering an empty string : "" NTST will return the solution in level 1: of the stack. Meanwhile, this code also verify that no other solution exists. One may spare running time by indicating a starting sequence such as "381" NST and the code will search for solution only starting with 381... eventually a solution may be found or the program ends leaving the stack unchanged. EDIT: On my HP-28S founding the solution starting with the empty string "" and scanning over all possibilities takes about 2'54". A shorter time may be reach (aka 1'22") by KILLing the process as soon as the unique solution is found. (by replacing DUP DEPTH ROLLD sequence by a KILL) EDIT #2: translating this RPL code into HP-71B's BASIC, I get a five liner of 158 octets: Code: 10 DESTROY ALL @ CALL NTST("") @ END On my HP-71B, the solution is found in 1'12" |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)