Post Reply 
HHC 2019 will be in Reno, Nevada, Sept 21-22
09-28-2019, 12:44 AM
Post: #51
RE: HHC 2019 will be in Reno, Nevada, Sept 21-22
(09-23-2019 01:54 PM)Claudio L. Wrote:  My take, nothing clever here, just plain brute force. I had solved this previously, I found this code already in my calc I guess from some old challenge?.
Anyway, the trivial code was also in my calc already and Wes already posted it, so I won't repeat it. I do want to post this other version which splits the digits from a single loop.
Is quite straightforward, uses the newRPL-only DIGITS command to extract digits off a number ( <number> <start_digit> <end_digit> DIGITS):
Code:


«
  100 999 FOR 'K'
    K 0 0 DIGITS 3 ^
    K 1 1 DIGITS 3 ^ +
    K 2 2 DIGITS 3 ^ +
    IF K == THEN  K  END
  NEXT
»

This version runs in 0.097 seconds, while Wes fastest runs in 0.068 seconds. That's when run from within a program, if executed from the keyboard it's 0.556 seconds and 0.531 seconds respectively due to power-saving clock management.

Hello Claudio....was this written and run on an HP Prime or a different calculator? I was curious about how you arrived at the very accurate msec. timing.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HHC 2019 will be in Reno, Nevada, Sept 21-22 - jjohnson873 - 09-28-2019 12:44 AM



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