Post Reply 
HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits
08-31-2017, 10:57 AM
Post: #27
RE: HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits
(08-30-2017 02:08 PM)Claudio L. Wrote:  
(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.

For a version of this programme in Sys RPL see

http://www.hpmuseum.org/forum/thread-8941.html
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-31-2017 10:57 AM



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