login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A329356
The binary expansion of a(n) is the first n terms of 2 - A000002.
3
0, 1, 2, 4, 9, 19, 38, 77, 154, 308, 617, 1234, 2468, 4937, 9875, 19750, 39501, 79003, 158006, 316012, 632025, 1264050, 2528101, 5056203, 10112406, 20224813, 40449626, 80899252, 161798505, 323597011, 647194022, 1294388045, 2588776091, 5177552182, 10355104365
OFFSET
0,3
FORMULA
a(n) = floor((1-c/2)*2^n), where c = A118270 is the Kolakoski constant. - Lorenzo Sauras Altuzarra, Jan 01 2023
EXAMPLE
a(7) = 77 has binary expansion q = {1, 0, 0, 1, 1, 0, 1}, and 2 - q is {1, 2, 2, 1, 1, 2, 1}, which is the first 7 terms of A000002.
MATHEMATICA
kolagrow[q_]:=If[Length[q]<2, Take[{1, 2}, Length[q]+1], Append[q, Switch[{q[[Length[Split[q]]]], q[[-2]], Last[q]}, {1, 1, 1}, 0, {1, 1, 2}, 1, {1, 2, 1}, 2, {1, 2, 2}, 0, {2, 1, 1}, 2, {2, 1, 2}, 2, {2, 2, 1}, 1, {2, 2, 2}, 1]]]
kol[n_Integer]:=If[n==0, {}, Nest[kolagrow, {1}, n-1]];
Table[FromDigits[2-kol[n], 2], {n, 0, 30}]
CROSSREFS
Replacing "2 - A000002" with "A000002 - 1" gives A329355.
Initial subsequences of A000002 are A329360.
Sequence in context: A309267 A262864 A129784 * A125050 A056186 A265387
KEYWORD
nonn,easy
AUTHOR
Gus Wiseman, Nov 12 2019
STATUS
approved