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.

Showing 1-2 of 2 results.

A047813 Largest palindromic substring of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 11, 2, 3, 4, 5, 6, 7, 8, 9, 2, 2, 22, 3, 4, 5, 6, 7, 8, 9, 3, 3, 3, 33, 4, 5, 6, 7, 8, 9, 4, 4, 4, 4, 44, 5, 6, 7, 8, 9, 5, 5, 5, 5, 5, 55, 6, 7, 8, 9, 6, 6, 6, 6, 6, 6, 66, 7, 8, 9, 7, 7, 7, 7, 7, 7, 7, 77, 8, 9, 8, 8, 8, 8, 8, 8, 8, 8, 88, 9, 9, 9, 9, 9, 9, 9
Offset: 0

Views

Author

Keywords

Comments

a(n) = A262188(n,A262190(n)-1). - Reinhard Zumkeller, Sep 14 2015

Examples

			a(1313) = Max{1,3,131,313} = 313.
		

Crossrefs

Programs

  • Haskell
    a047813 = last . a262188_row
    -- Reinhard Zumkeller, Sep 14 2015, Aug 23 2011
    
  • Mathematica
    palQ[n_Integer, base_Integer] := Module[{idn = IntegerDigits[n, base]}, idn == Reverse[ idn]]; f[n_] := Block[{id = IntegerDigits@ n, mx = -Infinity}, k = Length@ id; While[k > 0 && mx == -Infinity, mx = Max[mx, Select[ FromDigits@# & /@ Partition[id, k, 1], palQ[#, 10] &]]; k--]; mx] (* Robert G. Wilson v, Aug 24 2011 *)
    lps[n_]:=Module[{idn=IntegerDigits[n]},Max[FromDigits/@Select[ Flatten[ Table[ Partition[ idn,i,1],{i,Length[idn]}],1],#==Reverse[#]&]]]; Array[ lps,100,0] (* Harvey P. Dale, Jan 09 2015 *)
  • Python
    def c(s): return (s[0] != "0" or s == "0") and s == s[::-1]
    def a(n):
        s = str(n)
        ss = (s[i:j] for i in range(len(s)) for j in range(i+1, len(s)+1))
        return max(int(w) for w in ss if c(w))
    print([a(n) for n in range(96)]) # Michael S. Branicky, Sep 18 2022

A262224 a(n+1) = a(n) + (largest palindrome in decimal representation of a(n)), a(0) = 1.

Original entry on oeis.org

1, 2, 4, 8, 16, 22, 44, 88, 176, 183, 191, 382, 390, 399, 498, 507, 514, 519, 528, 536, 542, 547, 554, 609, 618, 626, 1252, 1504, 1509, 1518, 1669, 1735, 1742, 1749, 1758, 1766, 1832, 1840, 1848, 2696, 3392, 3425, 3430, 3773, 7546, 7553, 7608, 7616, 8232
Offset: 0

Views

Author

Reinhard Zumkeller, Sep 15 2015

Keywords

Comments

a(n+1) = a(n) + A047813(a(n)) = A262223(a(n)).

Crossrefs

Cf. A047813, A262223, A262243 (first differences).

Programs

  • Haskell
    a262224' n = a262224_list' !! n
    a262224_list' = iterate a262223 1
Showing 1-2 of 2 results.