login
A145865
a(0) = 0, a(1) = 1, a(2n) = a(n), a(2n+1) = a(n) - a(n+1).
1
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, -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, -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
OFFSET
0,16
COMMENTS
Variation on Stern's Diatomic Series
LINKS
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
Sequence in context: A369454 A224444 A101808 * A341281 A076452 A076453
KEYWORD
easy,sign
AUTHOR
STATUS
approved