HP Forums
(50G) Characteristic Function of OEIS A053432 - 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) Characteristic Function of OEIS A053432 (/thread-5006.html)



(50G) Characteristic Function of OEIS A053432 - Gerald H - 10-25-2015 06:47 AM

https://oeis.org/A053432

lists the numbers having digits read left to right in alphabetic order in English reading 0 as "zero".

The programme below for integer input returns a 1. if the number is in the sequence A053432, 0. otherwise.

I doubt the programme can be improved & would be pleased to be proven wrong.

Alternative algorithms welcome.

Code:

::
  CK1&Dispatch
  # FF
  ::
    BINT0
    "549176320"
    ROT
    FPTR2 ^Z>S
    DUPLEN$
    ZERO_DO
    2DUP
    CAR$
    BINT1
    POSCHR
    DUP4UNROLL
    5ROLL
    #<ITE
    ExitAtLOOP
    CDR$
    LOOP
    ROTROT2DROP
    NULL$?
    COERCEFLAG
  ;
;