%I #14 Jan 29 2024 01:27:46
%S 1,-1,2,1,-2,-2,2,-1,-2,2,-2,2,0,-2,-4,1,0,2,0,-2,4,2,0,-2,3,0,2,2,-2,
%T 4,2,-1,-4,0,-4,-2,0,0,0,2,0,-4,0,-2,4,0,0,2,3,-3,0,0,-2,-2,4,-2,0,2,
%U -2,-4,0,-2,-4,1,0,4,0,0,0,4,0,2,2,0,6,0,-4,0
%N a(n) is multiplicative with a(2^e) = (-1)^e, a(3^e) = -2*(-1)^e if e>0, a(p^e) = e+1 if p == 1, 7 (mod 24), a(p^e) = (e+1) * (-1)^e if p == 5, 11 (mod 24), a(p^e) = (1 + (-1)^e) / 2 if p == 13, 17, 19, 23 (mod 24).
%C Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).
%H G. C. Greubel, <a href="/A263649/b263649.txt">Table of n, a(n) for n = 1..1000</a>
%H Michael Somos, <a href="/A010815/a010815.txt">Introduction to Ramanujan theta functions</a>, 2019.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/RamanujanThetaFunctions.html">Ramanujan Theta Functions</a>.
%F a(2*n) = - a(n). a(3*n) = 2 * A115660(n). a(3*n + 1) = A263571(n+1). a(3*n + 2) = - A263548(n).
%F a(6*n + 1) = A261115(n). a(6*n + 3) = 2 * A128580(n). a(6*n + 5) = -2 * A128582(n).
%F Sum_{k=1..n} abs(a(k)) ~ (2/3)*sqrt(2/3)*Pi*n. - _Amiram Eldar_, Jan 29 2024
%e G.f. = x - x^2 + 2*x^3 + x^4 - 2*x^5 - 2*x^6 + 2*x^7 - x^8 - 2*x^9 + ...
%t a[ n_] := If[ n < 1, 0, Times @@ (Which[ # < 4, {-1, 1, -2}[[#]] (-1)^#2, Mod[#, 24] < 12, (#2 + 1) KroneckerSymbol[ #, 12]^#2, True, 1 - Mod[#2, 2]]& @@@ FactorInteger[n])];
%o (PARI) {a(n) = my(A, p, e); if( n<1, 0, A = factor(n); prod(k=1, matsize(A)[1], [p, e] = A[k, ]; if( p==2, (-1)^e, p==3, -2 * (-1)^e, p%24>12, 1-e%2, (e+1) * kronecker(p, 12)^e )))};
%Y Cf. A115660, A128580, A128582, A261115, A263548, A263571.
%Y Cf. A000122, A000700, A010054, A121373.
%K sign,mult
%O 1,3
%A _Michael Somos_, Oct 22 2015