Post Reply 
(49G) OEIS A028907
01-28-2024, 08:14 PM
Post: #2
RE: (49G) OEIS A028907
Also for fun, 2 UserRPL versions:
1/ for HP-49/50
Code:
 « SQ
   IF DUP 9 > THEN
      { }
      WHILE OVER REPEAT 
         SWAP 10 IDIV2 ROT + 
      END
      NIP SORT
      « SWAP 10 * + » STREAM 
   END
 » 'A028907' STO
2/ for HP-28, without calling a sort function:
Code:
 « SQ { }
   WHILE OVER REPEAT 
      SWAP 10 MOD LAST / IP SWAP ROT + 
   END
   1
   WHILE DUP 9 ≤ REPEAT
      WHILE DUP2 POS REPEAT
         LAST ROT SWAP 0 PUT
         ROT 10 * ROT SWAP OVER + ROT ROT
      END
      1 +
   END DROP2
 » 'A028907' STO
My old HP-28S runs it only 3 times slower than my Hp-50g does.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(49G) OEIS A028907 - Gerald H - 11-22-2014, 04:17 PM
RE: (49G) OEIS A028907 - AerobarSW - 01-28-2024 08:14 PM
RE: (49G) OEIS A028907 - mfleming - 01-29-2024, 03:52 PM



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