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?
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
Rémy Sigrist, Density plot of the first 16000000 terms
Altug Alkan, A scatterplot of a(n) for n <= 15*2^12
Altug Alkan, A scatterplot of a(n) for 15*2^12 <= n <= 15*2^14
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