OFFSET
1,2
COMMENTS
If n is odd then the run is 1's, otherwise it's 2's.
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
{n: A156728(n-1)=1}. - R. J. Mathar, Sep 14 2012
EXAMPLE
Kolakoski sequence starts 1221121 so we can see that this sequence begins 1,2,4,6,7.
PROG
(JavaScript)
a=new Array();
a[1]=1; a[2]=2; a[3]=2;
cd=1; ap=3;
for (i=4; i<50; i++)
{
if (a[ap]==1) a[i]=cd;
else {a[i]=cd; a[i+1]=cd; i++}
ap++;
cd=3-cd;
}
/* document.write(a); document.write("<br>"); */
b=new Array();
b[1]=1;
c=2;
for (i=2; i<50; i++)
if (a[i]!=a[i-1]) b[c++]=i;
document.write(b);
(Haskell)
a216345 n = a216345_list !! (n-1)
a216345_list = 1 : (filter (\x -> a000002 x /= a000002 (x - 1)) [2..])
-- Reinhard Zumkeller, Aug 03 2013
CROSSREFS
KEYWORD
nonn
AUTHOR
Jon Perry, Sep 04 2012
STATUS
approved