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.

A184988 Largest palindromic substring of n^2.

Original entry on oeis.org

0, 1, 4, 9, 6, 5, 6, 9, 6, 8, 1, 121, 44, 9, 9, 22, 6, 9, 4, 6, 4, 44, 484, 9, 7, 6, 676, 9, 8, 8, 9, 9, 4, 9, 11, 22, 9, 9, 444, 5, 6, 8, 7, 9, 9, 202, 11, 22, 4, 4, 5, 6, 7, 9, 9, 5, 313, 9, 33, 8, 6, 7, 44, 969, 9, 22, 6, 44, 6, 7, 9, 5, 8, 9, 7, 6, 77, 929
Offset: 0

Views

Author

Jonathan Vos Post, Mar 27 2011

Keywords

Comments

Leading 0's are not allowed, so a(103) = 9, not 060. - Robert Israel, Nov 05 2020

Examples

			a(15) = largest palindromic substring of 15^2 = largest palindromic substring of 225 = 22.
		

Crossrefs

Programs

  • Maple
    g:= proc(S) S[1] <> "0" and S = StringTools:-Reverse(S) end proc:
    f:= proc(n) local S,d,l,i,Q;
      S:= sprintf("%d",n^2);
      d:= length(S);
      for l from d to 1 by -1 do
        Q:= select(g, [seq(S[i..i+l-1],i=1..d+1-l)]);
        if Q <> [] then return op(sscanf(max(Q),"%d")) fi
      od;
    end proc:
    f(0):= 0:
    map(f, [$0..200]); # Robert Israel, Nov 05 2020

Formula

a(n) = A047813(A000290(n)).