login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) = a(floor(n/2)) + (-1)^(n*(n+1)/2) with a(1)=0.
1

%I #38 Sep 01 2020 13:41:20

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

%T 2,4,3,1,-1,1,-1,-3,-1,1,-1,-3,-5,-3,-1,-3,-1,1,3,1,-1,1,-1,-3,-1,1,3,

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

%N a(n) = a(floor(n/2)) + (-1)^(n*(n+1)/2) with a(1)=0.

%C For 2^(2*k-1) - 1 < n < 2^(2*k), k>0, there's no n such that a(n)=0.

%C For 2^(2*k) - 1 < n < 2^(2*k+1), k>0, there are A000984(k+1) n's such that a(n)=0.

%H Robert Israel, <a href="/A320042/b320042.txt">Table of n, a(n) for n = 1..10000</a>

%F a(1) = 0, a(n) = a(floor(n/2)) + (-1)^(n*(n+1)/2).

%F a(n) = 2*A092339(n+1) - A000523(n).

%e a(9) = a(4) + (-1)^45 = -1, a(10) = a(5) + (-1)^55 = -3.

%e For 7 < n < 16, there's no n such that a(n)=0; for 15 < n < 32, there are 6 n's such that a(n)=0.

%p a:=proc(n) `if`(n=1,0,a(floor(n/2))+(-1)^(n*(n+1)/2)) end: seq(a(n),n=1..100); # _Muniru A Asiru_, Oct 07 2018

%t a[1] = 0; a[n_] := a[n] = a[Floor[n/2]] + (-1)^(n*(n + 1)/2); Table[a@n, {n, 1, 50}]

%o (PARI) a(n) = if (n==1, 0, a(n\2) + (-1)^(n*(n+1)/2)); \\ _Michel Marcus_, Oct 05 2018

%Y Cf. A000523, A000984, A007088, A092339.

%K sign,look,hear

%O 1,5

%A _Jinyuan Wang_, Oct 03 2018

%E More terms from _Michel Marcus_, Oct 05 2018