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”).
%I #11 Dec 21 2016 08:11:01
%S 0,1,1,0,1,1,0,-1,1,0,1,1,0,1,-1,-2,1,1,0,-1,1,0,1,1,0,-1,1,2,-1,1,-2,
%T -3,1,0,1,1,0,1,-1,-2,1,1,0,-1,1,0,1,1,0,1,-1,-2,1,-1,2,3,-1,-2,1,3,
%U -2,1,-3,-4,1,1,0,-1,1,0,1,1,0,-1,1,2,-1,1,-2,-3,1,0,1,1,0,1,-1,-2,1,1,0
%N a(0) = 0, a(1) = 1, a(2n) = a(n), a(2n+1) = a(n) - a(n+1).
%C Variation on Stern's Diatomic Series
%H Michael De Vlieger, <a href="/A145865/b145865.txt">Table of n, a(n) for n = 0..10000</a>
%F From _Chai Wah Wu_, Dec 20 2016: (Start)
%F a(2^k*n+1) = a(n+1) if k is even
%F a(2^k*n+1) = a(n)-a(n+1) = a(2n+1) if k is odd
%F a(2^k*n+2^k-1) = a(n) - k*a(n+1)
%F a(2^k*n+2^k-3) = a(n+1) for k >= 2
%F a(2^k*n+2^k-5) = (k-1)*a(n+1)-a(n) for k >= 3
%F a(2^k*n+2^k-7) = a(n) - (k-2)*a(n+1) for k >= 3
%F This implies that
%F a(2^k+1) = 1 if k is even
%F a(2^k+1) = 0 if k is odd
%F a(2^k-1) = 2 - k for k >= 1
%F a(2^k-3) = 1 for k >= 2
%F a(2^k-5) = k - 3 for k >= 3
%F a(2^k-7) = 4 - k for k >= 3
%F (End)
%t a[0] = 0; a[1] = 1; a[n_] := a[n] = If[EvenQ@ n, a[n/2], a[#] - a[# + 1] &[(n - 1)/2]]; Table[a@ n, {n, 0, 85}] (* _Michael De Vlieger_, Dec 21 2016 *)
%Y Cf. A002487, A005590.
%K easy,sign
%O 0,16
%A _Paolo P. Lava_ and _Giorgio Balzarotti_, Oct 22 2008