Post Reply 
HHC 2019 will be in Reno, Nevada, Sept 21-22
09-23-2019, 01:54 PM
Post: #30
RE: HHC 2019 will be in Reno, Nevada, Sept 21-22
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.
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 - Claudio L. - 09-23-2019 01:54 PM



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