login
A334820
Sequence is limit_{t->oo} s_t, where s_k = s_{k-1},s_{k-1}[k-1..end] starting with s_0 = s_0[0..1] = 0,1.
2
0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1
OFFSET
0,1
COMMENTS
A nonperiodic sequence of 0 and 1.
MAPLE
s:= proc(n) option remember; `if`(n=0, [0, 1][],
(l-> [l[], l[n..-1][]][])([s(n-1)]))
end:
s(10); # gives 1035 = A005126(10) terms; # Alois P. Heinz, May 12 2020
MATHEMATICA
a[n_] := If[n<2, n, Module[{k = Floor@Log[2, n], m = n}, m-=k+1; While[k >= 0, If[BitGet[m, k]==0, m++; If[BitGet[m, k]==1, Return[1]]]; k--]]; 0];
a /@ Range[0, 104] (* Jean-François Alcover, Nov 16 2020, after Kevin Ryde *)
PROG
(PARI) a(n) = { if(n, my(k=logint(n, 2)); n-=k+1; while(k>=0, if(!bittest(n, k), n++; if(bittest(n, k), return(1))); k--)); 0; } \\ Kevin Ryde, Jun 26 2020
CROSSREFS
Cf. A005126 (s lengths), A057215.
Sequence in context: A284533 A286665 A096270 * A308185 A159689 A174282
KEYWORD
nonn
AUTHOR
Richard Aime Blavy, May 12 2020
STATUS
approved