OFFSET
0,1
COMMENTS
A nonperiodic sequence of 0 and 1.
LINKS
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
KEYWORD
nonn
AUTHOR
Richard Aime Blavy, May 12 2020
STATUS
approved