

A249507


Length of full iterated word (direct branch and reverse branch) of the Kolakoski sequence A000002 initiated at A000002(n). If the reverse branch is longer than the direct branch, the total length is counted negatively: if A000002(n) = 2, a(n) = 0; if A000002(n) = 1, a(n) = (ld+lr1)*sign(ldlr) with ld = max { k  A000002(ni+1) = A000002(i), 0<i<=k } and lr = max { k  A000002(ni+1) = A000002(i), 0<i<=k }.


8



0, 0, 4, 2, 0, 5, 0, 0, 10, 0, 0, 4, 2, 0, 2, 4, 0, 0, 8, 0, 2, 2, 0, 8, 0, 0, 4, 2, 0, 2, 2, 0, 5, 0, 0, 14, 0, 0, 4, 2, 0, 5, 0, 0, 5, 0, 2, 2, 0, 2, 4, 0, 0, 24, 0, 0, 4, 2, 0, 5, 0, 0, 10, 0, 0, 4, 2, 0, 2, 2, 0, 5, 0, 0, 5, 0, 2, 4, 0, 0, 38, 0, 0, 4, 2, 0, 5
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

2,3


COMMENTS

The Kolakoski sequence A000002 has a fractal structure that appears in the infinite number of iterations and reverse iterations of itself that it contains. Each iteration develops itself in two branches, a right branch in the direct sense, and a left branch in the reverse sense, e.g., 1221221121. This sequence gives the length of the full iterated word with its right and left branches starting at position n (with a length = 0 if A000002(n) = 2 <> A000002(1) = 1).
Each iterated word is generated by a preceding and shorter one, starting with 12 or 21 with the 1 in odd position. 12 for example gives, as long as the image of the initial 1 remains in odd position: 12 > 21221 > 1221221121 > ... (21 generates the same succession with words in reverse order). The right branch is thus always formed by a term of A054351 (successive generations of the OK sequence), and the left branch by a term of the same sequence in reverse order.
The lengths of the 2 branches are never equal, because a fully symmetric iterated word would necessitate at the beginning the word 12121, which never appears in the OK sequence (it would need 111 before in the OK sequence to appear), but the 2 branches cannot differ by more than two successive generations, again because a greater difference would imply an impossible word at the beginning, namely 112211.
The iterated words are initiated by the 1's in the OK sequence, but the 1's in pairs 11 can only lead to very short iterated words: (1)12(1) or (1)1221(2), or the same in reverse order, with values in this sequence of +/2 or +/4. On the contrary, each of the single 1's (212) in the OK sequence (except the first) is associated with an iterated word of length at least five, and (conjecture) it is likely that there is no bound to the length of iterated words associated with a single 1.
The number of iterated words with the right branch longer than the left seems to be well balanced, so that (conjecture) the limit of partial sums of this sequence could be o(n).


LINKS

JeanChristophe Hervé, Table of n, a(n) for n = 2..99990


FORMULA

a(n) = (A249093(n) + A249094(n)  min(1, A249093(n))) * sign(A249093(n)  A249094(n)).


EXAMPLE

The OK sequence begins as (highlighting the 10th term): 12211212212211211221211... where the iterated word 1221221121 of length 10 can be seen around the 10th term; thus a(10) = 10.


CROSSREFS

Cf. A000002, A054351, A054352, A249093, A249094, A249508.
Sequence in context: A016690 A136715 A077116 * A135730 A188595 A144102
Adjacent sequences: A249504 A249505 A249506 * A249508 A249509 A249510


KEYWORD

sign


AUTHOR

JeanChristophe Hervé, Oct 30 2014


STATUS

approved



