%I #22 Apr 11 2018 03:00:07
%S 0,0,1,2,0,4,0,0,7,0,0,1,2,0,1,4,0,0,2,0,1,2,0,7,0,0,1,2,0,1,2,0,4,0,
%T 0,11,0,0,1,2,0,4,0,0,2,0,1,2,0,1,4,0,0,18,0,0,1,2,0,4,0,0,7,0,0,1,2,
%U 0,1,2,0,4,0,0,2,0,1,4,0,0,28,0,0,1,2,0,4
%N Length of self-iteration of the Kolakoski sequence A000002 starting at A000002(n): a(n) = max { k | A000002(n+i-1) = A000002(i), 0 < i <= k }.
%C The Kolakoski sequence A000002 has a fractal structure that appears in the infinite number of iterations of itself that it contains. This sequence gives the length of the iteration starting at position n (with a length = 0 if A000002(n) = 2 <> A000002(1) = 1).
%C Recalling that A000002 begins as 1221121221..., the apparition of these iterations is easily understood from the evolution of an initial 2 in even position in A000002, which generates: 2 > (1)22(1) > (2)122112(1) > (1)221221121221(2)... (as long as the equivalent of the initial 2 in the successive iterates remains in even position). This example shows that the iterations are growing forward and backward in a symmetric pattern. The lengths of the backward iterations are in A249094 and the lengths of the full iterations with the two branches are in A249507.
%C Because each iteration must be generated by a preceding (and shorter) iteration, each branch is constituted of a term of A054351 (successive generations of the Kolakoski sequence), and the nonzero values of this sequence are all in A054352. That is, the only possible nonzero lengths of iterations are 1, 2, 4, 7, 11, ..., and a given value > 1 cannot appear in this sequence before the other smaller values.
%C Conjecture: for any k, there is an iteration of length A054352(k) in A000002.
%H Jean-Christophe Hervé, <a href="/A249093/b249093.txt">Table of n, a(n) for n = 2..99990</a>
%e A000002(n) = 2 => a(n) = 0 since the Kolakoski sequence begins with 1. a(7) = 4 since A000002(7:10) = A000002(1:4) and A000002(11) <> A000002(5).
%Y Cf. A000002, A054351, A054352, A249094, A249507, A249508.
%K nonn
%O 2,4
%A _Jean-Christophe Hervé_, Oct 28 2014