%I #17 Jun 05 2019 11:49:09
%S 1,1,2,4,2,4,3,3,2,4,6,5,7,2,4,3,5,7,9,11,13,3,2,4,6,8,10,12,14,16,18,
%T 20,22,6,3,2,4,6,5,7,2,4,3,3,2,4,6,8,10,12,6,5,7,2,4,3,5,7,9,11,13,3,
%U 2,4,6,5,7,2,4,3,5,7,6,3,2,4,6,8,10,12,2,4
%N Let K_n = prefix of length n of Kolakoski sequence A000002; a(n) is the length of the longest palindromic suffix of K_n.
%H Rémy Sigrist, <a href="/A307095/b307095.txt">Table of n, a(n) for n = 1..10000</a>
%H Rémy Sigrist, <a href="/A307095/a307095.gp.txt">PARI program for A307095</a>
%F a(n+1) <= a(n) + 2.
%e The first terms, alongside K_n with longest palindromic suffix in parentheses, are:
%e n a(n) K_n
%e -- ---- ------------------
%e 1 1 (1)
%e 2 1 1(2)
%e 3 2 1(22)
%e 4 4 (1221)
%e 5 2 122(11)
%e 6 4 12(2112)
%e 7 3 1221(121)
%e 8 3 12211(212)
%e 9 2 1221121(22)
%e 10 4 122112(1221)
%e 11 6 12211(212212)
%e 12 5 1221121(22122)
%e 13 7 122112(1221221)
%e 14 2 122112122122(11)
%e 15 4 12211212212(2112)
%e 16 3 1221121221221(121)
%o (PARI) See Links section.
%Y See A220080 for a similar sequence.
%Y Cf. A000002.
%K nonn
%O 1,3
%A _Rémy Sigrist_, Jun 04 2019