HP Forums

Full Version: (50G) Counting without Zeros, OEIS A52382
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The programme NZCNT reproduces the OEIS sequence

http://oeis.org/A052382

of zeroless numbers.

eg For input

98765432167

the programme returns

312833523494.

ZNCNT performs the inverse transformation.

NZCNT

Code:

::
  CK1&Dispatch
  # FF
  ::
    FPTR2 ^DupQIsZero?
    caseSIZEERR
    NULL$SWAP
    BEGIN
    Z9_
    FPTR2 ^ZDIVext
    FPTR2 ^DupQIsZero?
    IT
    ::
      FPTR2 ^DROPZ1
      FPTR2 ^RSUBext
      Z9_
    ;
    FPTR2 ^Z>S
    ROT
    &$SWAP
    FPTR2 ^DupQIsZero?
    UNTIL
    DROP
    FPTR2 ^S>Z
  ;
;

ZNCNT

Code:

::
  CK1&Dispatch
  # FF
  ::
    DUP
    FPTR2 ^Z>S
    CHR_0
    BINT1
    POSCHR
    #0<>
    caseSIZEERR
    Z0Z1_
    ROTDUP
    CODE 00025 143174E78FB9760131174143818F858DC7530
    ZERO_DO
    Z10_
    FPTR2 ^ZDIVext
    ROTDUP
    Z9_
    FPTR2 ^RMULText
    4UNROLL
    FPTR2 ^RMULText
    4ROLL
    FPTR2 ^RADDext
    3UNROLL
    LOOP
    2DROP
  ;
;
Reference URL's