logoalt Hacker News

Kolakoski Sequence

57 pointsby surprisetalklast Monday at 6:31 PM11 commentsview on HN

Comments

MontyCarloHalltoday at 4:44 PM

For those not getting this immediately (I sure didn't):

              _____________
   sequence   1 2 2 1 1 2 1 2 2 1
   run lens   1 2-- 2-- 1 1 2-- 1
Read out the bottom sequence of run lengths, and be amazed that it's the same as the first 7 digits as the top sequence. Extend the bottom to continue to recapitulate the top sequence, and add terms to the top sequence accordingly to reflect the run lengths in the bottom sequence. Repeat infinitely.
show 1 reply
nwellnhoftoday at 5:15 PM

There's a fascinating way to generate the Kolakoski sequence with bit fiddling: https://11011110.github.io/blog/2016/10/14/kolakoski-sequenc...

vindex10today at 5:49 PM

Is it a coincidence that it is number 2 in the OEIS?)