HP Forums
(50g) OEIS A014263: Integers with Exclusively Even Digits - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (50g) OEIS A014263: Integers with Exclusively Even Digits (/thread-8922.html)



(50g) OEIS A014263: Integers with Exclusively Even Digits - Gerald H - 08-27-2017 03:03 PM

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
  ;
;



RE: (50g) OEIS A014263: Integers with Even Digits - Joe Horn - 08-27-2017 07:56 PM

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.


RE: (50g) OEIS A014263: Integers with Even Digits - Eric Rechlin - 08-27-2017 10:00 PM

It works fine for me. I have added a compiled version to my site here:

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


RE: (50g) OEIS A014263: Integers with Even Digits - Joe Horn - 08-27-2017 11:55 PM

(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!


RE: (50g) OEIS A014263: Integers with Even Digits - Gerald H - 08-28-2017 05:41 AM

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.


RE: (50g) OEIS A014263: Integers with Even Digits - 3298 - 08-28-2017 11:46 AM

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.


RE: (50g) OEIS A014263: Integers with Exclusively Even Digits - Gerald H - 08-29-2017 10:24 AM

(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.