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.
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, 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, 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
Offset: 1
Keywords
Examples
Kolakoski's sequence separated into pieces: (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,... so we get 2, 2, 4, 3, 2, 3, 2, 4, 4, 2, 3, 4, 3, 2, 4, 4, ...
Crossrefs
Cf. A000002.
Programs
-
Python
# See A000002 for the definition of Kolakoski() def a306323(): last = count = 0 for k in Kolakoski(): if k is last: yield count count = 0 count += 1 last = k from itertools import islice print(*list(islice(a306323(), 108)), sep=', ') # corrected by David Radcliffe, May 10 2025
Comments