OFFSET
0,16
COMMENTS
Variation on Stern's Diatomic Series
LINKS
Michael De Vlieger, Table of n, a(n) for n = 0..10000
FORMULA
From Chai Wah Wu, Dec 20 2016: (Start)
a(2^k*n+1) = a(n+1) if k is even
a(2^k*n+1) = a(n)-a(n+1) = a(2n+1) if k is odd
a(2^k*n+2^k-1) = a(n) - k*a(n+1)
a(2^k*n+2^k-3) = a(n+1) for k >= 2
a(2^k*n+2^k-5) = (k-1)*a(n+1)-a(n) for k >= 3
a(2^k*n+2^k-7) = a(n) - (k-2)*a(n+1) for k >= 3
This implies that
a(2^k+1) = 1 if k is even
a(2^k+1) = 0 if k is odd
a(2^k-1) = 2 - k for k >= 1
a(2^k-3) = 1 for k >= 2
a(2^k-5) = k - 3 for k >= 3
a(2^k-7) = 4 - k for k >= 3
(End)
MATHEMATICA
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 *)
CROSSREFS
KEYWORD
easy,sign
AUTHOR
Paolo P. Lava and Giorgio Balzarotti, Oct 22 2008
STATUS
approved