HHC 2019 will be in Reno, Nevada, Sept 21-22
|
09-25-2019, 07:26 PM
Post: #45
|
|||
|
|||
RE: HHC 2019 will be in Reno, Nevada, Sept 21-22
(09-24-2019 02:22 AM)dramsey Wrote: Regarding this year's programming contest: You also required that the four results be on the stack at the end, so after four were found it would be natural to stop. Pretending that I did not know there would be only four results, and therefore not knowing that they would fit on the stack so I had to come up with my own way to present the results, I came up with the program below, for 42S/DM42/Free42. It simply seqentially checks all 3 digit numbers, then stops and shows each successful result as it is found. The user must press R/S to continue, with "999" in the X register indicating all numbers have been checked and all successful results displayed. Code:
(This program used the core of my program for Gene's "Happy Number" challenge of a few years ago which summed digits squared - so I had the code handy and it was easy to modify that to sum digits cubed. Also, yes, it could stop at 963, but that's not much of an optimization so I just go all the way to 999.) Dave - My mind is going - I can feel it. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)