Post Reply 
[VA] Short & Sweet Math Challenge #24: "2019 Spring Special 5-tier"
04-21-2019, 07:06 AM (This post was last modified: 04-21-2019 10:47 PM by Gilles.)
Post: #40
RE: [VA] Short & Sweet Math Challenge #24: "2019 Spring Special 5-tier"
Tier 1 :

Here is my solution without reading others responses. I image that there exists better way. This one is "bestial" ;D Always impressed how fast NewRPL is.

Brutal force :

1/ HP50g NewRPL or RPL

Code:
«
 0 
 1000001111 1E10 FOR 'n' 
  n ->STR
  IF "0" "" SREPL 1 == THEN 
   IF "1" "" SREPL 1 == THEN 
    IF "2" "" SREPL 1 == THEN 
     IF "3" "" SREPL 1 == THEN 
      IF "4" "" SREPL 1 == THEN 
       IF "5" "" SREPL 1 == THEN 
        IF "6" "" SREPL 1 == THEN 
         IF "7" "" SREPL 1 == THEN 
          IF "8" "" SREPL 1 == THEN 
           IF "9" "" SREPL 1 == THEN 
            SWAP 1 + SWAP
  END END END END END END END END END END
  DROP
 11111 STEP
»
Solved in only 1.3s in newRPL (on my PC) , 116s with HP50g hdw, much much slower in 779s in RPL (on my PC with Emu48). NewRPL 600 times faster in this case on a PC.
2/ HP50g RPL with ListExt, shorter but slower

Code:
« 0 1000001111 1E10 FOR n  n I->NL LDDUP SIZE 10 == { 1 + } IFT  11111 STEP »
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] Short & Sweet Math Challenge #24: "2019 Spring Special 5-tier" - Gilles - 04-21-2019 07:06 AM



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