Post Reply 
HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits
08-30-2017, 02:08 PM (This post was last modified: 08-30-2017 02:11 PM by Claudio L..)
Post: #25
RE: HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits
(08-30-2017 01:02 PM)Gerald H Wrote:  Slightly shorter version of Werner's programme:

Code:
« "" SWAP
  DO 1 - DUP 5 MOD
DUP + 1 + ROT +
SWAP 5 IQUOT DUP
NOT
  UNTIL
  END DROP OBJ→
»

Even shorter when you use IDIV2:
Code:
« "" SWAP
  DO 1 - 5 IDIV2
DUP + 1 + ROT +
SWAP DUP
NOT
  UNTIL
  END DROP OBJ→
»

At only 65.5 bytes, this one gets the title for short code.
This one clocked at 24.2 sec for 100 runs on a 50g, so it doesn't quite beat Werner.
On newRPL, interestingly, it causes a 19x slowdown because of invoking the decompiler. Removing OBJ-> makes it only 2.2x slower than plain Werner and 2.9x slower than mine.

**EDIT**: This algorithm only runs in exact mode, BTW. In approx. mode the trailing dot in the reals messes up the string and OBJ-> gives an error.
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-30-2017 02:08 PM



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