[go: up one dir, main page]

login
A216345
Position of the beginning of the n-th run in A000002.
6
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, 38, 40, 42, 43, 44, 46, 47, 48, 50, 51, 53, 55, 56, 58, 60, 61, 62, 64, 65, 67, 69, 70, 72, 73, 74, 76, 77, 78, 80, 82, 83, 85, 87, 88, 89, 91, 92, 94, 96, 97, 99, 101, 102, 103
OFFSET
1,2
COMMENTS
If n is odd then the run is 1's, otherwise it's 2's.
LINKS
FORMULA
{n: A156728(n-1)=1}. - R. J. Mathar, Sep 14 2012
a(n+1) = A054353(n)+1 = a(n) + A000002(n). - Jean-Christophe Hervé, Oct 05 2014
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