%I #72 Aug 06 2024 09:17:43
%S 1,3,3,3,1,1,1,3,3,3,1,3,1,3,3,3,1,1,1,3,3,3,1,3,3,3,1,3,3,3,1,1,1,3,
%T 3,3,1,3,1,3,3,3,1,1,1,3,3,3,1,3,3,3,1,1,1,3,3,3,1,3,3,3,1,1,1,3,3,3,
%U 1,3,1,3,3,3,1,1,1,3,3,3,1,3,3,3,1,3,3,3,1,1,1,3,3,3,1,3,1,3,3,3,1,1,1,3,3
%N Kolakoski-(1,3) sequence: the alphabet is {1,3}, and a(n) is the length of the n-th run.
%C Historical note: the sequence (a(n)) was introduced (by me) in 1981 in a seminar in Bordeaux. It was remarked there that (a(n+1)) is a morphic sequence, i.e., a letter-to-letter projection of a fixed point of a morphism. The morphism is 1->3, 2->2, 3->343, 4->212. The letter-to-letter map is 1->1, 2->1, 3->3, 4->3. There it was also remarked that this allows one to compute the frequency of the letter 3, and an exact expression for this frequency involving sqrt(177) was given. - _Michel Dekking_, Jan 06 2018
%C The frequency of the number '3' is 0.6027847... See UWC link. - _Jaap Spies_, Dec 12 2004
%C The terms 13, 13331, 13331113331 are primes. - _Vincenzo Librandi_, Mar 02 2016
%C Consider the Kolakoski sequence generalized to the alphabet {A,B}, where A=2p+1, B=2q+1. The fraction of symbols that are A approaches f_A, calculated as follows: x=(p+q+1)/3; y=((p-q)^2)/2; lambda = x + (x^3+y+sqrt(y^2+2*x^3*y))^(1/3) + (x^3+y-sqrt(y^2+2*x^3*y))^(1/3); f_A=(lambda-2q-1)/(2p-2q). The technique is the "simple computation" mentioned by Dekking and repeated in the UWC link. - _Ed Wynn_, Jul 29 2019
%D E. Angelini, "Jeux de suites", in Dossier Pour La Science, pp. 32-35, Volume 59 (Jeux math'), April/June 2008, Paris.
%D F. M. Dekking: "What is the long range order in the Kolakoski sequence?" in: The Mathematics of Long-Range Aperiodic Order, ed. R. V. Moody, Kluwer, Dordrecht (1997), pp. 115-125.
%H Reinhard Zumkeller, <a href="/A064353/b064353.txt">Table of n, a(n) for n = 1..10000</a>
%H Michael Baake and Bernd Sing, <a href="https://arxiv.org/abs/math/0206098">Kolakoski-(3,1) is a (deformed) model set</a>, arXiv:math/0206098 [math.MG], 2002-2003.
%H F. M. Dekking, <a href="http://www.digizeitschriften.de/dms/img/?PID=GDZPPN002544490">On the structure of self-generating sequences</a>, Seminar on Number Theory, 1980-1981 (Talence, 1980-1981), Exp. No. 31, 6 pp., Univ. Bordeaux I, Talence, 1981. Math. Rev. 83e:10075.
%H F. M. Dekking, <a href="https://citeseerx.ist.psu.edu/pdf/7af40df61b38208d1eccca350f4869b6f1a6a18f">What Is the Long Range Order in the Kolakoski Sequence?</a>, Report 95-100, Technische Universiteit Delft, 1995.
%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.
%H Jaap Spies, <a href="http://www.jaapspies.nl/bookb5.pdf">A Bit of Math, The Art of Problem Solving</a>, Jaap Spies Publishers (2019).
%H UWC, <a href="http://www.math.leidenuniv.nl/%7Enaw/serie5/deel05/jun2004/pdf/uwc.pdf">Opgave A</a> (<a href="http://www.jaapspies.nl/mathfiles/opgave2004-2A.pdf">solution</a>)
%t A = {1, 3, 3, 3}; i = 3; next = 1; While[Length[A] < 140, A = Join[A, next*Array[1&, A[[i]]]]; i++; next = 4-next]; A (* _Jean-François Alcover_, Nov 12 2016, translated from MATLAB *)
%o (MATLAB) A = [1 3 3 3]; i = 3; next = 1; while length(A) < 140 A = [A next*ones(1, A(i))]; i = i + 1; next = 4 - next; end
%o (Haskell) -- from John Tromp's a000002.hs
%o a064353 n = a064353_list !! (n-1)
%o a064353_list = 1 : 3 : drop 2
%o (concat . zipWith replicate a064353_list . cycle $ [1, 3])
%o -- _Reinhard Zumkeller_, Aug 02 2013
%Y Cf. A000002, A071820, A071907, A071928, A071942.
%Y See also A362927, A362928 (subtract 2 from the terms). For indices of 1's and 3's, see A362929, A362930.
%K nonn,easy,nice
%O 1,2
%A _N. J. A. Sloane_
%E More terms from _David Wasserman_, Jul 16 2002
%E Edited by _Charles R Greathouse IV_, Apr 20 2010
%E Restored the original definition, following a suggestion from _Jianing Song_. - _N. J. A. Sloane_, May 13 2021