login
a(n) = (-1)^floor(n/2) * A035185(n).
2

%I #7 Dec 17 2017 03:09:20

%S 1,-1,0,1,0,0,-2,1,1,0,0,0,0,-2,0,1,2,-1,0,0,0,0,-2,0,1,0,0,2,0,0,-2,

%T 1,0,-2,0,1,0,0,0,0,2,0,0,0,0,-2,-2,0,3,-1,0,0,0,0,0,2,0,0,0,0,0,-2,

%U -2,1,0,0,0,2,0,0,-2,1,2,0,0,0,0,0,-2,0,1,-2

%N a(n) = (-1)^floor(n/2) * A035185(n).

%H G. C. Greubel, <a href="/A259829/b259829.txt">Table of n, a(n) for n = 1..10000</a>

%F G.f.: Sum_{n >= 1} -(-1)^n * q^(n*(n+1)/2)*(1-q)*(1-q^2)*...*(1-q^(n-1))/ ((1+q)*(1+q^2)*...*(1+q^n)). - _Jeremy Lovejoy_, Jun 12 2009

%F a(4*n) = A035185(n). a(8*n + 3) = a(8*n + 5) = 0.

%e G.f. = x - x^2 + x^4 - 2*x^7 + x^8 + x^9 - 2*x^14 + x^16 + 2*x^17 - x^18 + ...

%t a[ n_] := If[ n < 1, 0, (-1)^Quotient[n, 2] DivisorSum[ n, KroneckerSymbol[ 2, #]&]];

%t a[ n_] := If[ n < 1, 0, I^(1 - n) Times @@ ( Which[ # == 1, 1, # == 2, -I, Mod[#, 8] > 1 && Mod[#, 8] < 7, 1 - Mod[#2, 2], True, #2 + 1] & @@@ FactorInteger @ n)];

%o (PARI) {a(n) = if( n<1, 0, (-1)^(n\2) * sumdiv( n, d, kronecker( 2, d)))};

%o (PARI) {a(n) = my(A, p, e); if( n<1, 0, A = factor(n); I^(1-n) * prod(k=1, matsize(A)[1], [p, e] = A[k, ]; if(p==2, -I, p%8>1 && p%8<7, !(e%2), e+1)))};

%Y Cf. A035185.

%K sign

%O 1,7

%A _Michael Somos_, Jul 06 2015