%I #22 Jul 25 2023 10:12:53
%S 1,2,2,3,3,4,4,4,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,1,2,3,4,4,1,1,2,2,3,3,
%T 4,4,4,1,1,1,2,2,2,3,3,3,4,4,4,4,1,1,1,1,2,2,2,2,3,3,3,3,4,1,1,2,2,2,
%U 3,3,3,3,4,4,4,4,1,2,3,3,4,4,1,1,1,2,2,2,3,3,3,3,4,4,4,4,1,1,1,1,2,3,4,1,1
%N Kolakoski variation using (1,2,3,4) starting with 1,2.
%C a(1)=1 then a(n) is the length of n-th run. This kind of Kolakoski variation using(1,2,3,4,...,m) as m grows reaches the Golomb's sequence A001462.
%H Ivan Neretin, <a href="/A079730/b079730.txt">Table of n, a(n) for n = 1..10000</a>
%H Ulrich Reitebuch, Henriette-Sophie Lipschütz, and Konrad Polthier, <a href="https://archive.bridgesmathart.org/2023/bridges2023-481.html">Visualizing the Kolakoski Sequence</a>, Bridges Conf. Proc.; Math., Art, Music, Architecture, Culture (2023) 481-484.
%F Partial sum sequence is expected to be asymptotic to 5/2*n.
%e Sequence begins: 1,2,2,3,3,4,4,4,1,1,1,2,2,2,2,3,3,3,3, read it as: (1),(2,2),(3,3),(4,4,4),(1,1,1),(2,2,2,2),(3,3,3,3),... then count the terms in parentheses to get: 1,2,2,3,3,4,4,.. which is the same sequence.
%t seed = {1, 2, 3, 4};
%t w = {};
%t i = 1;
%t Do[
%t w = Join[w,
%t Array[seed[[Mod[i - 1, Length[seed]] + 1]] &,
%t If[i > Length[w], seed, w][[i]]]];
%t i++
%t , {n, 41}];
%t w
%Y Cf. A000002.
%K nonn
%O 1,2
%A _Benoit Cloitre_, Feb 17 2003
%E Corrected by _Ivan Neretin_, Apr 01 2015