← RoseCode

ROSECODE 442

Kolakoski Sequence

Min_25 · Math ·

Let K(a,b) be the infinite sequence such that:

  • The first element is a,
  • It consists of a and b, and
  • Its run length sequence is equal to K(a,b).

Here, for example, we assume that the run length sequence of [1,1,1,2,3,4,4,5] is [3,1,1,2,1].

We can verify that

  • K(2,3)=[2,2,3,3,2,2,2,3,3,3,2,], and
  • K(2,4)=[2,2,4,4,2,2,2,2,4,4,4,4,2,].

Let Ca,b(N) be the number of a in the first N elements of K(a,b).

For example, C2,4(4)=2 and C2,4(5) = 3.

Let S(M,N):=a=2M1b=a+1MCa,b(N).

You are given S(5,100)=300 and S(10,106)=17856847.

Find S(100,1015).