Post Reply 
HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits
09-01-2017, 09:12 PM
Post: #33
RE: HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits
Here's a recursive version. The recursive program is stored in the local ←P variable. It finds the 50th number in 0.23s and the 1E6'th in 0.77s on a 50g.
Code:
«
  «
  1 -
  IF DUP 4 >
  THEN
    5 IDIV2 SWAP ←P EVAL @ Get the value for N/5
  ELSE
    0
  END
  10 * @ 10 * F(N/5)
  SWAP 2 * 1 +  @ F(N % 5)
  +
  » → ←P « ←P EVAL »
»
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 - David Hayden - 09-01-2017 09:12 PM



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