login
A305299
a(0) = 0, a(1) = 1, a(2) = 2; for n >= 2, a(2*n-1) = n - 2*a(n-1) - 1, a(2*n) = a(2*n-1) - a(n).
2
0, 1, 2, -1, -3, -2, -1, 5, 8, 10, 12, 9, 10, 8, 3, -3, -11, -8, -18, -11, -23, -14, -23, -7, -17, -8, -16, -3, -6, 8, 11, 21, 32, 38, 46, 33, 51, 54, 65, 41, 64, 66, 80, 49, 72, 68, 75, 37, 54, 58, 66, 41, 57, 58, 61, 33, 39, 40, 32, 13, 2, 8, -13, -11, -43, -32, -70, -43, -89, -58, -91, -31, -82, -66, -120, -71, -136, -92
OFFSET
0,3
COMMENTS
This sequence has an approximate self-similar block structure, which is roughly described by A110286, see Links section.
a(0) = 0 by definition. The next 0 is a(970) = 0. What are the other numbers k such that a(k) = 0?
MAPLE
f:= proc(n) option remember;
if n::odd then (n-1)/2-2*procname((n-1)/2)
else procname(n-1)-procname(n/2)
fi
end proc:
f(0):= 0: f(1):= 1: f(2):= 2:
map(f, [$0..77]); # after Robert Israel at A294044
MATHEMATICA
a[0] = 0; a[1] = 1; a[2] = 2; a[n_] := If[EvenQ[n], a[n - 1] - a[n/2], (n - 1)/2 - 2 a[(n - 1)/2]]; Table[a[n], {n, 0, 77}] (* after Ilya Gutkovskiy at A294044 *)
PROG
(PARI) a(n)=if(n<=2, n, if(n%2==1, (n-1)/2-2*a((n-1)/2), a(n-1)-a(n/2)));
(PARI) a = vector(77); print1 (0", "); for (k=1, #a, print1 (a[k]=if (k<=2, k, my (n=k\2); if (k%2==0, a[2*n-1]-a[n], n-2*a[n]))", ")) \\ after Rémy Sigrist at A303028
CROSSREFS
KEYWORD
sign,look
AUTHOR
Altug Alkan, Aug 18 2018
STATUS
approved