Post Reply 
(50G) Self Numbers, OEIS A003052
03-24-2016, 10:20 AM (This post was last modified: 06-15-2017 01:37 PM by Gene.)
Post: #1
(50G) Self Numbers, OEIS A003052
For non-negative integer input the programme returns the smallest Self number greater than the input to the stack.

eg For input

98765432167

the programme returns

98765432176

which is indeed the next Self number.

For more info on self numbers see:

https://oeis.org/A003052

Code:

::
  CK1&Dispatch
  # FF
  ::
    FPTR2 ^DupZIsNeg?
    caseSIZEERR
    BINT0
    1LAMBIND
    BEGIN
    Z1_
    FPTR2 ^RADDext
    DUP
    Z2_
    FPTR2 ^ZQUOText
    OVERDUP
    CODE 00025 143174E78FB9760131174143818F858DC7530
    FPTR2 ^#>Z
    Z9_
    FPTR2 ^RMULText
    FPTR2 ^RSUBext
    FPTR2 ^ZNMax
    1PUTLAM
    DUP
    BEGIN
    ::
      Z1_
      FPTR2 ^RSUBext
      DUP
      1GETLAM
      Z<
      case
      ::
        FPTR2 ^DROPZ0
        TRUE
      ;
      DUP
      FPTR2 ^Z>S
      DUP
      BIGDISPROW3
      ZEROSWAP
      DUPLEN$
      ZERO_DO
      DUP
      CAR$
      CHR>#
      BINT48
      #-
      ROT+SWAP
      CDR$
      LOOP
      DROP
      FPTR2 ^#>Z
      OVER
      FPTR2 ^RADDext
      3PICK
      EQUAL
    ;
    UNTIL
    FPTR2 ^QIsZero?
    UNTIL
    ABND
  ;
;
Find all posts by this user
Quote this message in a reply
Post Reply 




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