The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.



(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A054351 Successive generations of the Kolakoski sequence A000002. 11


%S 1,12,1221,1221121,12211212212,122112122122112112,

%T 1221121221221121122121121221,

%U 1221121221221121122121121221121121221221121,12211212212211211221211212211211212212211212212112112212211212212

%N Successive generations of the Kolakoski sequence A000002.

%o (Python)

%o from itertools import accumulate, groupby, repeat

%o def K(n, _):

%o c, s = "12", ""

%o for i, k in enumerate(str(n)): s += c[i%2]*int(k)

%o return int(s + c[(i+1)%2])

%o def aupton(nn): return list(accumulate(repeat(1, nn+1), K))

%o print(aupton(8)) # _Michael S. Branicky_, Jan 12 2021

%Y Cf. A054348, A054349, A054350, A054352, A042942, A000002.

%Y Word lengths give A054352.

%K nonn,easy

%O 0,2

%A _N. J. A. Sloane_, May 07 2000

%E More terms from Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Apr 05 2003

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 7 03:48 EDT 2021. Contains 343636 sequences. (Running on oeis4.)