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.

A136687 Number of palindromes in the range [0,n] inclusive.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Apr 21 2008

Keywords

Comments

Partial sums of A136522. [Typo fixed by Colin Barker, Apr 26 2015]

Crossrefs

Programs

  • Mathematica
    palQ[n_]:=Module[{idn=IntegerDigits[n]},idn==Reverse[idn]]; Accumulate[ Table[ If[palQ[n],1,0],{n,0,80}]] (* Harvey P. Dale, May 11 2014 *)
  • PARI
    A136687(n)=inv_A002113(A261423(n)) \\ M. F. Hasler, Sep 09 2018
    
  • Python
    def A136687(n):
        l = len(s:=str(n))
        k = l+1>>1
        return n//10**(l-k)-(int(s[k-1::-1])>n%10**k)+10**(k-1+(l&1^1)) # Chai Wah Wu, Jul 24 2024

Formula

a(n) = inv_A002113(A261423(n)), where inv_A002113 is the inverse of A002113, i.e., it yields the index of a palindrome. - M. F. Hasler, Sep 10 2018