(50g) OEIS A014263: Integers with Exclusively Even Digits
08-27-2017, 03:03 PM (This post was last modified: 08-29-2017 10:22 AM by Gerald H.)
Post: #1
 Gerald H Senior Member Posts: 1,459 Joined: May 2014
(50g) OEIS A014263: Integers with Exclusively Even Digits
For integer input N the programme returns the Nth integer composed solely of even digits.

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   ; ;
08-27-2017, 07:56 PM
Post: #2
 Joe Horn Senior Member Posts: 1,798 Joined: Dec 2013
RE: (50g) OEIS A014263: Integers with Even Digits
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.

<0|ɸ|0>
-Joe-
08-27-2017, 10:00 PM
Post: #3
 Eric Rechlin Senior Member Posts: 357 Joined: Dec 2013
RE: (50g) OEIS A014263: Integers with Even Digits
It works fine for me. I have added a compiled version to my site here:

http://www.hpcalc.org/details/8653
08-27-2017, 11:55 PM (This post was last modified: 08-27-2017 11:56 PM by Joe Horn.)
Post: #4
 Joe Horn Senior Member Posts: 1,798 Joined: Dec 2013
RE: (50g) OEIS A014263: Integers with Even Digits
(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!

<0|ɸ|0>
-Joe-
08-28-2017, 05:41 AM
Post: #5
 Gerald H Senior Member Posts: 1,459 Joined: May 2014
RE: (50g) OEIS A014263: Integers with Even Digits
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

for his insight.
08-28-2017, 11:46 AM
Post: #6
 3298 Member Posts: 178 Joined: Oct 2014
RE: (50g) OEIS A014263: Integers with Even Digits
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-29-2017, 10:24 AM
Post: #7
 Gerald H Senior Member Posts: 1,459 Joined: May 2014
RE: (50g) OEIS A014263: Integers with Exclusively Even Digits
(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.
 « Next Oldest | Next Newest »

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