Post Reply 
HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits
08-29-2017, 09:23 AM (This post was last modified: 08-29-2017 09:49 AM by Gerald H.)
Post: #7
RE: HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits
Just to start the ball rolling here my current attempt

Code:
« DUP 1 <
  IF
  THEN DROP 0
  ELSE 1
    « DUP 10 MOD 9 <
      IF
      THEN DUP 2 MOD +
      ELSE 10 IQUOT ←G EVAL 10 *
      END 1 +
    »
    « OVER 1 ==
      IF
      THEN NIP
      ELSE SWAP 1 - SWAP ←G EVAL ←H EVAL
      END
    »  → ←G ←H
    « ←H EVAL
    »
  END
»

CKSUM ABED

SIZE 228.

TIMING:

INPUT 50 TAKES 6 SECONDS TO RETURN 179
Edit: Sorry, not 6s but 18.3s
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 - Gerald H - 08-29-2017 09:23 AM



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