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”).
%I #17 Oct 15 2022 08:09:33
%S 1,0,0,2,2,0,0,2,1,0,0,0,2,0,0,2,2,0,0,4,0,0,0,0,3,0,0,0,2,0,0,2,0,0,
%T 0,2,2,0,0,4,2,0,0,0,2,0,0,0,1,0,0,4,2,0,0,0,0,0,0,0,2,0,0,2,4,0,0,4,
%U 0,0,0,2,2,0,0,0,0,0,0,4,1,0,0,0,4,0,0,0,2,0,0,0,0,0,0,0,2,0,0,6,2,0,0,4,0
%N Half the number of integer solutions to x^2 + 4 * y^2 = n.
%D B. C. Berndt, Ramanujan's Notebooks Part V, Springer-Verlag, see p. 373 Entry 32.
%D J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 120.
%H G. C. Greubel, <a href="/A113406/b113406.txt">Table of n, a(n) for n = 1..1000</a>
%F a(n) is multiplicative with a(2) = 0, a(2^e) = 2 if e>1, a(p^e) = e+1 if p == 1 (mod 4), a(p^e) = (1 + (-1)^e)/2 if p == 3 (mod 4)
%F G.f.: (theta_3(q) * theta_3(q^4) - 1) / 2.
%F a(4*n + 2) = a(4*n + 3) = 0. A004531(n) = 2 * a(n) if n>0. a(4*n + 1) = A008441(n). A004018(n) = 2 * a(4*n) if n>0.
%F Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Pi/4 = 0.785398... (A003881). - _Amiram Eldar_, Oct 15 2022
%e x + 2*x^4 + 2*x^5 + 2*x^8 + x^9 + 2*x^13 + 2*x^16 + 2*x^17 + 4*x^20 + ...
%t s = (EllipticTheta[3, 0, q]*EllipticTheta[3, 0, q^4] - 1)/(2 q) + O[q]^105; CoefficientList[s, q] (* _Jean-François Alcover_, Dec 02 2015 *)
%o (PARI) {a(n) = if( n<1, 0, qfrep( [1, 0; 0, 4], n)[n])}
%o (PARI) {a(n) = if( n<1, 0, if( n%4==1, sumdiv( n, d, (-1)^(d\2)), if( n%4==0, 2 * sumdiv( n, d, kronecker( -4, d)))))}
%o (PARI) {a(n) = local(A, p, e); if( n<1, 0, A = factor(n); prod( k=1, matsize(A)[1], if( p = A[k,1], e = A[k,2]; if( p==2, 2 * (e>1), if( p%4==3, (1 + (-1)^e) / 2, e+1)))))}
%Y Cf. A003881, A004018, A004531, A008441.
%K nonn,mult
%O 1,4
%A _Michael Somos_, Oct 28 2005