The Kolakoski sequence is generated by constructing alternating blocks of 1s and 2s. The number of digits in the ith block is equal to the value of the ith digit.