Post Reply 
HHC 2019 will be in Reno, Nevada, Sept 21-22
09-30-2019, 04:15 PM
Post: #60
RE: HHC 2019 will be in Reno, Nevada, Sept 21-22
One final RPL version: no loops!

This one is also newRPL specific (sorry, it's what I use, I don't mean to leave anybody out):

Code:

«
  0 9 1 RANGE      @ Make a case-list of numbers 0-9
 3 ^ DUPDUP + +    @ Sum of the cubes of the digits of ALL numbers from 0 to 999
 1 «
    IF DUP NSUB 1 - ≠ NSUB 100 < OR THEN
      DROP 
    END
  »
  DOSUBS           @ And some list processing (remove if Sum()≠ index on the list)
»

Loopless is not faster, mainly because of the overhead of creating the lists, but worth a look as a curiosity. This one runs in 113ms.
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-30-2019 04:15 PM



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