OFFSET
1,3
LINKS
David A. Corneth, Table of n, a(n) for n = 1..10000
EXAMPLE
For n = 36, the n-th palindrome is the 36th palindrome i.e., 262. The sum of digits of 262 (in base 10) is 2 + 6 + 2 = 10 hence a(36) = 10.
MATHEMATICA
Total[IntegerDigits[#]]&/@Select[Range[0, 750], PalindromeQ] (* Harvey P. Dale, Feb 11 2022 *)
PROG
(PARI) a(n)={my(d, i, r); r=vector(#digits(n-10^(#digits(n\11)))+#digits(n\11)); n=n-10^(#digits(n\11)); d=digits(n); for(i=1, #d, r[i]=d[i]; r[#r+1-i]=d[i]); vecsum(r)} \\ David A. Corneth, Sep 29 2023
(Python)
def A043269(n):
if n == 1: return 0
y = 10*(x:=10**(len(str(n>>1))-1))
return int((s:=str(n-x))[-1])+(sum(int(d) for d in s[:-1])<<1) if n<x+y else sum(map(int, str(n-y)))<<1 # Chai Wah Wu, Jun 13 2024
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
STATUS
approved