Post Reply 
HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits
08-29-2017, 08:28 PM (This post was last modified: 08-29-2017 10:11 PM by Claudio L..)
Post: #14
RE: HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits
My take:

Code:

«
  1 10 → 
    RES M « 1 - DUP 2
    * 'RES' STO+ WHILE
    DUP 5 ≥ REPEAT
      5 - 5 IQUOT DUP
      M * 'RES' STO+ 10
      'M' STO* 
    END
    DROP RES 
  »
»

168 bytes on newRPL (can somebody test this on userRPL?)
Returns a(10^6) = 335777779 as per the original sequence link, so I think it's correct.

Does 1000 runs with 1e6 as argument in 0.953 seconds (<< 1 1000 START 1E6 NODD NEXT >>). Would be nice if somebody can measure in userRPL.
EDIT: For comparison, with 50 as argument it returns 179, and does 1000 runs in 0.603 seconds.

** EDIT AGAIN **: I got caught by my own design :-), turns out newRPL runs at 6MHz the first 300 msec, therefore doing 1000 runs is not representative of the true speed. Another run now with 50000 times took 7.94 seconds, so roughly it takes 0.16 msec to compute with an argument of 50, and 0.45 msec with an argument of 1e6.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits - Claudio L. - 08-29-2017 08:28 PM



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