login
A216637
Kolakoski sequence by 3-words.
0
3, 1, 3, 3, 1, 1, 5, 1, 3, 1, 1, 3, 3, 1, 3, 2, 2, 3, 3, 1, 3, 3, 1, 1, 3, 2, 3, 3, 1, 3, 3, 1, 1, 5, 1, 3, 3, 1, 1, 3, 1, 1, 5, 1, 1, 5, 4, 5, 5, 1, 5, 5, 1, 1, 5, 4, 5, 5, 1, 1, 5, 1, 3, 1, 1, 3, 2, 3, 3, 1, 3, 3, 1, 1, 3, 1, 1, 5, 5, 1, 3, 1, 1, 5, 1, 1, 5, 5, 1, 3, 1, 1, 3, 3, 1, 3, 2, 2, 3, 3, 2, 3, 3, 1, 3, 3, 1, 1, 5, 1, 3, 3, 1, 3, 2, 3, 3, 1, 1, 3, 3, 1, 3, 2, 3, 3, 2, 2, 6, 2
OFFSET
1,1
COMMENTS
The Kolakoski sequences (A000002) can be seen as being formed from the 6-set of 3-words -> {1,1,2}, {1,2,1}, {1,2,2}, {2,1,1}, {2,1,2} and {2,2,1}. Labeling these as 1-6 gives the sequence.
The first 6 appears at a(129).
EXAMPLE
1,2,2,1,1,2 becomes 3,1
PROG
(JavaScript)
a=new Array();
a[1]=1; a[2]=2; a[3]=2; cd=1; ap=3;
for (i=4; i<1000; i++) {
if (a[ap]==1) a[i]=cd; else {a[i]=cd; a[i+1]=cd; i++}
ap++; cd=3-cd; }
for(i=1; i<300; i++) {
b=a.splice(1, 3).join();
switch (b) {
case "1, 1, 2": {document.write("1, "); break; }
case "1, 2, 1": {document.write("2, "); break; }
case "1, 2, 2": {document.write("3, "); break; }
case "2, 1, 1": {document.write("4, "); break; }
case "2, 1, 2": {document.write("5, "); break; }
case "2, 2, 1": {document.write("6, "); break; }
}
}
CROSSREFS
Cf. A000002.
Sequence in context: A122431 A279340 A089607 * A358643 A234308 A050141
KEYWORD
nonn
AUTHOR
Jon Perry, Sep 11 2012
STATUS
approved