login
a(0) = a(3) = 0, a(1) = a(2) = 1; for n >= 2, a(2*n) = -a(n-1) and a(2*n+1) = -a(n-1)-a(n).
1

%I #34 Sep 07 2018 06:20:03

%S 0,1,1,0,-1,-2,-1,-1,0,1,1,3,2,3,1,2,1,1,0,-1,-1,-2,-1,-4,-3,-5,-2,-5,

%T -3,-4,-1,-3,-2,-3,-1,-2,-1,-1,0,1,1,2,1,3,2,3,1,5,4,7,3,8,5,7,2,7,5,

%U 8,3,7,4,5,1,4,3,5,2,5,3,4,1,3,2,3,1,2,1,1,0,-1,-1,-2,-1,-3,-2,-3,-1,-4,-3,-5,-2,-5,-3,-4,-1,-6,-5,-9,-4,-11,-7

%N a(0) = a(3) = 0, a(1) = a(2) = 1; for n >= 2, a(2*n) = -a(n-1) and a(2*n+1) = -a(n-1)-a(n).

%C Inspired by A002487.

%C Alternatively, a(0) = 0, a(1) = 1; for n >= 1, a(2*n) = a(2*n-1) - a(2*n-2), a(2*n+1) = a(2*n) - a(n). Note that if b(0) = 0, b(1) = 1; for n >= 1, b(2*n) = b(2*n-1) - b(n), b(2*n+1) = b(2*n) - b(2*n-1), then b(n) + A213369(n+1) = 0 for all n >= 1.

%C The main block structure of this sequence is described by A020714.

%H Altug Alkan, <a href="/A318163/b318163.txt">Table of n, a(n) for n = 0..20480</a>

%H Altug Alkan, <a href="/A318163/a318163.png">A scatterplot of a(n) for n <= 5*2^12</a>

%H Altug Alkan, <a href="/A318163/a318163_1.png">A scatterplot of first differences of a(n) for n <= 5*2^13</a>

%F a(5*2^k-2) = 0 for all k >= 0.

%t a[0]=a[3]=0; a[1]=a[2]=1; a[n_] := a[n] = If[EvenQ[n], -a[n/2-1], -a[(n-1)/2 - 1] - a[(n-1)/2]]; Array[a, 101, 0] (* _Giovanni Resta_, Aug 27 2018 *)

%o (PARI) a = vector(100); print1(0", "); for(k=1, #a, print1 (a[k]=if(k<=2,1, my (n=k\2); if (k%2==0, -a[n-1], a[2*n]-a[n]))", "));

%Y Cf. A002487, A020944, A213369, A303404.

%K sign,easy

%O 0,6

%A _Altug Alkan_, Aug 19 2018