HP Forums
(49G) OEIS A002113: Palindromes in Base 10 in Natural Order - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (49G) OEIS A002113: Palindromes in Base 10 in Natural Order (/thread-9988.html)



(49G) OEIS A002113: Palindromes in Base 10 in Natural Order - Gerald H - 01-21-2018 03:19 PM

For natural number entry N the programme returns the Nth palindrome.

For info on palindromes see

https://oeis.org/A002113

For background to the programme see

http://www.hpmuseum.org/forum/thread-9922.html

Size: 166.5

CkSum: # A04h

Code:
::
  CK1&Dispatch
  # FF
  ::
    DUP
    ZINT 11
    Z<
    case
    ::
      ZINT 1
      FPTR2 ^RSUBext
    ;
    FPTR2 ^Z>S
    DUP
    CAR$
    CHR_1
    EQUAL
    OVER
    BINT2
    SUB$1#
    BINT48
    #<>
    ANDITE
    ::
      CDR$
      DUP
      '
      xSREV
      EvalNoCK
    ;
    ::
      DUP
      CDR$
      SWAP
      BINT1
      SUB$1#
      BINT49
      #-
      DUP#0=IT
      ::
        DROP
        CDR$
        BINT9
      ;
      #>$
      SWAP&$
      DUP
      '
      xSREV
      EvalNoCK
      CDR$
    ;
    &$
    FPTR2 ^S>Z
  ;
;