login
Position of the beginning of the n-th run in A000002.
6

%I #22 Oct 26 2014 15:26:51

%S 1,2,4,6,7,8,10,11,13,15,16,18,20,21,22,24,25,26,28,30,31,33,34,35,37,

%T 38,40,42,43,44,46,47,48,50,51,53,55,56,58,60,61,62,64,65,67,69,70,72,

%U 73,74,76,77,78,80,82,83,85,87,88,89,91,92,94,96,97,99,101,102,103

%N Position of the beginning of the n-th run in A000002.

%C If n is odd then the run is 1's, otherwise it's 2's.

%H Reinhard Zumkeller, <a href="/A216345/b216345.txt">Table of n, a(n) for n = 1..10000</a>

%F {n: A156728(n-1)=1}. - _R. J. Mathar_, Sep 14 2012

%F a(n+1) = A054353(n)+1 = a(n) + A000002(n). - _Jean-Christophe Hervé_, Oct 05 2014

%e Kolakoski sequence starts 1221121 so we can see that this sequence begins 1,2,4,6,7.

%o (JavaScript)

%o a=new Array();

%o a[1]=1; a[2]=2; a[3]=2;

%o cd=1; ap=3;

%o for (i=4; i<50; i++)

%o {

%o if (a[ap]==1) a[i]=cd;

%o else {a[i]=cd; a[i+1]=cd; i++}

%o ap++;

%o cd=3-cd;

%o }

%o /* document.write(a); document.write("<br>"); */

%o b=new Array();

%o b[1]=1;

%o c=2;

%o for (i=2; i<50; i++)

%o if (a[i]!=a[i-1]) b[c++]=i;

%o document.write(b);

%o (Haskell)

%o a216345 n = a216345_list !! (n-1)

%o a216345_list = 1 : (filter (\x -> a000002 x /= a000002 (x - 1)) [2..])

%o -- _Reinhard Zumkeller_, Aug 03 2013

%Y Cf. A000002, A054354.

%Y Cf. A100428, A100429.

%K nonn

%O 1,2

%A _Jon Perry_, Sep 04 2012