login
Exactly half of first a(n) terms of Kolakoski sequence A000002 are 1's (not known to be infinite).
9

%I #29 May 11 2021 09:06:45

%S 0,2,4,6,8,10,14,16,18,20,22,24,26,28,30,36,38,40,42,44,46,48,50,54,

%T 56,58,60,62,64,68,70,72,74,76,78,80,82,86,88,98,104,106,116,118,122,

%U 124,126,128,130,132,136,138,140,142,144,146,148,150,152,158

%N Exactly half of first a(n) terms of Kolakoski sequence A000002 are 1's (not known to be infinite).

%C The sequences A022292, A074261, and A342799 partition the nonnegative integers. - _Clark Kimberling_, May 10 2021

%H Joerg Arndt, <a href="/A022292/b022292.txt">Table of n, a(n) for n = 0..8739</a>

%F Conjecture: a(n) is asymptotic to c*n*log(n) for some constant c <= 1. - _Benoit Cloitre_, Nov 17 2003

%t k = Prepend[Nest[Flatten[Partition[#, 2] /. {{2, 2} -> {2, 2, 1, 1}, {2, 1} -> {2, 2, 1}, {1, 2} -> {2, 1, 1}, {1, 1} -> {2, 1}}] &, {2, 2}, 14], 1]; (* A000002 *)

%t Select[Range[400], Count[Take[k, #], 1] < #/2 &] (* A074261 *)

%t Select[Range[400], Count[Take[k, #], 1] == #/2 &] (* A022292 *)

%t Select[Range[400], Count[Take[k, #], 1] > #/2 &] (* A342799 *)

%t (* _Clark Kimberling_, May 10 2021 *)

%o (JavaScript)

%o a=new Array();

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

%o for (i=4; i<1000; 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 oc=0; tc=0;

%o for (i=1; i<1000; i++)

%o {

%o if (oc==tc) document.write(i-1+", ");

%o if (a[i]==1) oc++;

%o else tc++;

%o }

%o // _Jon Perry_, Sep 11 2012

%Y Cf. A000002, A074261, A022293, A342799.

%K nonn

%O 0,2

%A _Clark Kimberling_

%E 0 prepended by _Jon Perry_, Sep 11 2012