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.

A050431 Length of longest palindromic subword of (n base 3).

This page as a plain text file.
%I A050431 #14 Dec 17 2020 14:26:52
%S A050431 1,1,1,2,1,1,1,2,2,3,1,2,3,2,1,3,2,2,1,3,1,2,3,2,2,3,3,4,2,3,3,3,3,1,
%T A050431 2,2,3,2,3,4,3,2,3,2,2,1,3,3,3,3,2,4,3,3,2,4,3,2,1,3,3,3,2,3,1,2,3,4,
%U A050431 3,3,3,2,2,3,2,2,3,3,3,4,4,5,3,4,4,4,3,2,2,3
%N A050431 Length of longest palindromic subword of (n base 3).
%H A050431 Robert Israel, <a href="/A050431/b050431.txt">Table of n, a(n) for n = 1..10000</a>
%F A050431 a(n) <= min(a(3*n), a(3*n+1), a(3*n+2)). [_Reinhard Zumkeller_, Jul 31 2011]
%p A050431 LPS:= proc(L) local nL, n, i;
%p A050431   nL:= nops(L);
%p A050431   for n from nL to 1 by -1 do
%p A050431     for i from 1 to nL-n+1 do
%p A050431       if L[i..i+n-1] = ListTools:-Reverse(L[i..i+n-1]) then return n fi
%p A050431   od od:
%p A050431 end proc:
%p A050431 seq(LPS(convert(n, base, 3)), n=1..100); # Robert Israel, Dec 17 2020
%Y A050431 Cf. A050430, A050432, A050433.
%K A050431 nonn,base
%O A050431 1,4
%A A050431 _Clark Kimberling_