login
A303404
a(0) = 0, a(1) = 1; for n >= 1, a(2*n) = a(2*n-1) - 2*a(n), a(2*n+1) = n - 2*a(n).
4
0, 1, -1, -1, 1, 4, 6, 5, 3, 2, -6, -3, -15, -6, -16, -3, -9, 2, -2, 5, 17, 22, 28, 17, 47, 42, 54, 25, 57, 46, 52, 21, 39, 34, 30, 13, 17, 22, 12, 9, -25, -14, -58, -23, -79, -34, -68, -11, -105, -70, -154, -59, -167, -82, -132, -23, -137, -86, -178, -63, -167, -74, -116, -11, -89, -46, -114, -35, -95, -26, -52, 9
OFFSET
0,6
COMMENTS
Inspired by A002487.
A020714 is generally determinative for block structures of this sequence.
FORMULA
G.f. g(x) satisfies g(x) + 2*g(x^2)*(1+x+x^2) = x + x^2 + x^3 + x^4 + 2*x^5. - Robert Israel, Aug 20 2018
MAPLE
A[0]:= 0: A[1]:= 1:
for n from 1 to 50 do
A[2*n]:= A[2*n-1]-2*A[n];
A[2*n+1]:= n - 2*A[n]
od:
seq(A[i], i=0..101); # Robert Israel, Aug 20 2018
PROG
(PARI) a(n)=if(n<=1, n, if(n%2==0, a(n-1)-2*a(n/2), (n-1)/2-2*a((n-1)/2)));
CROSSREFS
Sequence in context: A222069 A274318 A256682 * A002245 A062117 A200497
KEYWORD
sign,look
AUTHOR
Altug Alkan, Aug 19 2018
STATUS
approved