HP Forums
(50g) OEIS A056524 & A056525: Palindromes with Even & Odd Number of Digits - 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) OEIS A056524 & A056525: Palindromes with Even & Odd Number of Digits (/thread-9921.html)



(50g) OEIS A056524 & A056525: Palindromes with Even & Odd Number of Digits - Gerald H - 01-13-2018 10:08 AM

Programme A056524 takes positive integer input N & returns the Nth even-digited palindromic number.

Programme A056525 takes positive integer input N & returns the Nth odd-digited palindromic number.

Together the 2 programmes produce all palindromic integers.

NB: 'EvalNoCK:_sup_ is PTR 25F29 & has been so at least from 1.19-6 on.

A056524

Code:
::
  CK1&Dispatch
  # FF
  ::
    FPTR2 ^Z>S
    DUP
    'EvalNoCK:_sup_
    xSREV
    &$
    FPTR2 ^S>Z
  ;
;

A056525

Code:
::
  CK1&Dispatch
  # FF
  ::
    FPTR2 ^Z>S
    DUP
    'EvalNoCK:_sup_
    xSREV
    CDR$
    &$
    FPTR2 ^S>Z
  ;
;