HP Forums
(50G) Counting without Zeros, OEIS A52382 - 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) Counting without Zeros, OEIS A52382 (/thread-4813.html)



(50G) Counting without Zeros, OEIS A52382 - Gerald H - 09-27-2015 09:49 AM

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