HP Forums

Full Version: (50g) OEIS A014263: Integers with Exclusively Even Digits
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
For integer input N the programme returns the Nth integer composed solely of even digits.

For more info see

http://oeis.org/A014263

Code:

::
  CK1&Dispatch
  # FF
  ::
    NULL$SWAP
    Z5_
    SWAP
    BEGIN
    OVER
    FPTR2 ^ZDIVext
    FPTR2 ^Z>S
    4ROLL
    &$
    3UNROLL
    FPTR2 ^DupQIsZero?
    UNTIL
    2DROP
    FPTR2 ^S>Z
    DUP
    FPTR2 ^RADDext
  ;
;
If "Z5_" means BINT5, then either I made a typo or there's a bug somewhere, because all it does is return 2x for any input x. E.g. Input 153, it returns 306 (contains an odd digit; answer should be 2206).

BYTES on the compiled program returns 75 #48F7h.
It works fine for me. I have added a compiled version to my site here:

http://www.hpcalc.org/details/8653
(08-27-2017 07:56 PM)Joe Horn Wrote: [ -> ]If "Z5_" means BINT5, then either I made a typo or there's a bug somewhere, because all it does is return 2x for any input x. E.g. Input 153, it returns 306 (contains an odd digit; answer should be 2206).

BYTES on the compiled program returns 75 #48F7h.

(08-27-2017 10:00 PM)Eric Rechlin Wrote: [ -> ]It works fine for me. I have added a compiled version to my site here:

http://www.hpcalc.org/details/8653

Aha! "Z5_" does NOT mean BINT5. It means ZINT 5, which I could only discover by downloading the copy from Eric's site and disassembling it. The built-in assembler does not know what "Z5_" means, and neither did I.

Suggestion: Use HP 50g ASM notation, and include the checksum (which is #FB66h for the above program), when posting System RPL source code. Thanks in advance!

By the way, Gerald, I really like the algorithm used here: Convert to base 5, then double that number as a base-10 number. Very cool!
Sorry, I forget that eg Z5_ is not standard, although Eric Rechlin must use the same tool as me.

As for your 2 suggestions - wilco.

Yes, a neat algorithm, thanks to

http://oeis.org/wiki/User:Franklin_T._Adams-Watters

for his insight.
Z5_ is an unsupported entry - the standard Extable doesn't have it (as far as I know) but there are modified Extable versions that include it along with many other unsupported entries. I'm using the one that comes with Emacs 2.11a and it compiles Z5_ just fine.
(08-27-2017 10:00 PM)Eric Rechlin Wrote: [ -> ]It works fine for me. I have added a compiled version to my site here:

http://www.hpcalc.org/details/8653

Thank you, Eric, for archiving my programme.
Reference URL's