The dragon Curve sequence
Mathematica 25 Bytes

1/2+JacobiSymbol[-1,#]/2&amp;


Other ways of doing this:

56 bytes

(v:=1-IntegerDigits[#,2,i][[1]];For[i=1,v&gt;0,i++];i++;v)&amp;


58 bytes

1-Nest[Join[#,{0},Reverse[1-#]]&amp;,{0},Floor@Log[2,#]][[#]]&amp;