cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A306323 Break up the Kolakoski sequence A000002 into pieces by inserting a space between every pair of equal terms; sequence gives lengths of successive pieces.

This page as a plain text file.
%I A306323 #58 May 10 2025 11:28:44
%S A306323 2,2,4,3,2,3,2,4,4,2,3,4,3,2,4,4,3,2,3,2,4,3,2,3,4,4,2,3,2,4,3,2,3,2,
%T A306323 4,4,3,2,3,4,2,3,2,4,3,2,3,2,4,4,2,3,4,3,2,3,2,4,4,3,2,4,4,2,3,4,4,2,
%U A306323 3,2,4,3,2,3,4,2,3,2,3,4,4,2,3,2,4,3,2,3,4,4,2,3,4,3,2,4,4,3,2,3,4,2,3,2,4,3,2,3
%N A306323 Break up the Kolakoski sequence A000002 into pieces by inserting a space between every pair of equal terms; sequence gives lengths of successive pieces.
%C A306323 The first 14 terms of Kolakoski's sequence are 1,2,2,1,1,2,1,2,2,1,2,2. When we break it into pieces, inserting a pair of parentheses between every two identical terms, we get (1,2),(2,1),(1,2,1,2),(2,1,2),..., and the lengths of the pieces form this sequence 2,2,4,3,...
%C A306323 This sequence only contains 2, 3 and 4. Proof: Considering 1, it would be 1,(1),1 or 2,(2),2 in Kolakoski's sequence, which is impossible  because there would be a 3 (or more) in former terms. And for 5 (or more), it would be 1,(1,2,1,2,1),1 (or similar to start with 2), where the terms which generate it would be 2+,1,1,1,2+, where three consecutive terms can't happen according to the former proof.
%C A306323 Except for the first two terms, two consecutive terms cannot be equal unless they're 4. Proof: Considering 2's, the terms in Kolakoski's sequence would be 1,1,2,2,1,1, which would be generated by 2,2,2. And for 3's, the terms in Kolakoski's sequence would be 1,1,2,1,1,2,1,1, which would be generated by 2,1,2,1,2, whose 2nd through 4th terms would be generated by 1,1,1.
%e A306323 Kolakoski's sequence separated into pieces:
%e A306323 (1,2), (2,1), (1,2,1,2), (2,1,2), (2,1), (1,2,1), (1,2), (2,1,2,1), (1,2,1,2), (2,1), (1,2,1), (1,2,1,2), (2,1,2), (2,1), (1,2,1,2), (2,1,2,1), (1,...
%e A306323 so we get
%e A306323 2, 2, 4, 3, 2, 3, 2, 4, 4, 2, 3, 4, 3, 2, 4, 4, ...
%o A306323 (Python)
%o A306323 # See A000002 for the definition of Kolakoski()
%o A306323 def a306323():
%o A306323     last = count = 0
%o A306323     for k in Kolakoski():
%o A306323         if k is last:
%o A306323             yield count
%o A306323             count = 0
%o A306323         count += 1
%o A306323         last = k
%o A306323 from itertools import islice
%o A306323 print(*list(islice(a306323(), 108)), sep=', ')
%o A306323 # corrected by _David Radcliffe_, May 10 2025
%Y A306323 Cf. A000002.
%K A306323 nonn
%O A306323 1,1
%A A306323 _Chia-Ching Chen_, Mar 25 2019