CentralNotice From Wikipedia, the free encyclopedia Jump to: navigation , search In mathematics , the Kolakoski sequence (named after William Kolakoski ) is an infinite sequence of symbols {1,2} which is its own run-length encoding . [1] The initial terms of the sequence are: 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,… (sequence A000002 in the OEIS ) Each symbol occurs in a "run" of either one or two consecutive terms, and writing down the lengths of these runs gives exactly the same sequence. It is the unique sequence with this property except for the same sequence with the initial 1 deleted. [1] 1 Algorithm 2 Density 3 History 4 See also 5 Notes 6 Further reading 7 External links Algorithm [ edit ] The sequence may be generated by an algorithm that, in the i th iteration, reads the value x i that has already been output as the i th...