cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A043269 a(n) is the sum of the digits of n-th base-10 palindrome.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 4, 6, 8, 10, 12, 14, 16, 18, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 12, 13, 14, 15, 16, 17
Offset: 1

Views

Author

Keywords

Examples

			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.
		

Crossrefs

Cf. A002113 (base-10 palindromes).

Programs

  • Mathematica
    Total[IntegerDigits[#]]&/@Select[Range[0,750],PalindromeQ] (* Harvey P. Dale, Feb 11 2022 *)
  • 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 nChai Wah Wu, Jun 13 2024

Formula

a(n) = A007953(A002113(n)). - R. J. Mathar, Jul 20 2025