login
Number of integer solutions to the equation x^2 + 3y^2 = n.
20

%I #58 Oct 15 2022 08:09:22

%S 1,2,0,2,6,0,0,4,0,2,0,0,6,4,0,0,6,0,0,4,0,4,0,0,0,2,0,2,12,0,0,4,0,0,

%T 0,0,6,4,0,4,0,0,0,4,0,0,0,0,6,6,0,0,12,0,0,0,0,4,0,0,0,4,0,4,6,0,0,4,

%U 0,0,0,0,0,4,0,2,12,0,0,4,0,2,0,0,12,0,0,0,0,0,0,8,0,4,0,0,0,4,0,0,6,0

%N Number of integer solutions to the equation x^2 + 3y^2 = n.

%C The cubic modular equation for k is equivalent to theta_4(q) * theta_4(q^3) + theta_2(q)* theta_2(q^3) = theta_3(q) * theta_3(q^3). - _Michael Somos_, Feb 17 2003

%C The number of nonnegative solutions is given by A119395. - _Max Alekseyev_, May 16 2006

%C Fermat used infinite descent to prove "That there is no number, less by a unit than a multiple of 3, which is composed of a square and the triple of another square". [Yves Hellegouarch, "Invitation to the Mathematics of Fermat-Wiles", Academic Press, 2002, page 4]. - _Michael Somos_, Sep 03 2016

%D J. M. Borwein, P. B. Borwein, Pi and the AGM, Wiley, 1987, p. 110.

%D J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p 102 eq 9.

%D N. J. Fine, Basic Hypergeometric Series and Applications, Amer. Math. Soc., 1988; p. 78, Eq. (32.25).

%H Antti Karttunen, <a href="/A033716/b033716.txt">Table of n, a(n) for n = 0..65537</a>

%H G. E. Andrews, R. Lewis and Z.-G. Liu, <a href="http://dx.doi.org/10.1112/blms/33.1.25">An identity relating a theta series to a sum of Lambert series</a>, Bull. London Math. Soc., 33 (2001), 25-31.

%H Michael Gilleland, <a href="/selfsimilar.html">Some Self-Similar Integer Sequences</a>.

%H M. D. Hirschhorn, <a href="http://www.mat.univie.ac.at/~slc/wpapers/s42hirsch.html">Three classical results on representations of a number</a>, Séminaire Lotharingien de Combinatoire, B42f (1999), 8 pp.

%H M. D. Hirschhorn, <a href="http://dx.doi.org/10.1016/j.disc.2004.08.045">The number of representations of a number by various forms</a>, Discrete Mathematics 298 (2005), 205-211.

%H H. Movasati and Y. Nikdelan, <a href="http://arxiv.org/abs/1603.09411">Gauss-Manin Connection in Disguise: Dwork Family</a>, arXiv preprint arXiv:1603.09411 [math.AG], 2016-2017.

%H N. J. A. Sloane et al., <a href="https://oeis.org/wiki/Binary_Quadratic_Forms_and_OEIS">Binary Quadratic Forms and OEIS</a> (Index to related sequences, programs, references).

%F Fine gives an explicit formula for a(n) in terms of the divisors of n.

%F Coefficients in expansion of Sum_{ i, j = -inf .. inf } q^(i^2+3*j^2).

%F G.f.: s(2)^5*s(6)^5/(s(1)^2*s(3)^2*s(4)^2*s(12)^2), where s(k) := subs(q=q^k, eta(q)), where eta(q) is Dedekind's function, cf. A010815. [Fine]

%F Euler transform of period 12 sequence [ 2, -3, 4, -1, 2, -6, 2, -1, 4, -3, 2, -2, ...]. - _Michael Somos_, Feb 17 2003

%F G.f. A(x) satisfies 0 = f(A(x), A(x^3), A(x^9)) where f(u1, u3, u9) = (u1*u9) * (u1^2 - 3*u1*u3 + 3*u3^2) * (u3^2 - 3*u3*u9 + 3*u9^2) - u3^6. - _Michael Somos_, Sep 05 2005

%F G.f.: theta_3(q) * theta_3(q^3) = (Sum_{k in Z} x^(k^2)) * (Sum_{k in Z} x^(3k^2)). - _Michael Somos_, Sep 05 2005

%F Let n=3^d*p1^(2*b1)*...*pm^(2*bm)*q1^c1*...*qk^ck be a prime factorization of n where pi are primes of the form 3t+2 and qj are primes of the form 3t+1. Let B=(c1+1)*...*(ck+1). Then a(n)=0 if either of bi is a half-integer; a(n)=6B if n is a multiple of 4; and a(n)=2B otherwise. - _Max Alekseyev_, May 16 2006

%F a(n) = 2 * A096936(n).

%F a(3*n + 2) = 0. a(3*n) = a(n). a(3*n + 1) = 2 * A129576(n). - _Michael Somos_, Sep 03 2016

%F Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Pi/sqrt(3) = 1.813799... (A093602). - _Amiram Eldar_, Oct 15 2022

%e G.f. = 1 + 2*q + 2*q^3 + 6*q^4 + 4*q^7 + 2*q^9 + 6*q^12 + 4*q^13 + 6*q^16 + ...

%p A033716 := proc(n)

%p local a,j ;

%p a := 0 ;

%p for j from 0 to n/3 do

%p a := a+A000122(n-3*j)*A000122(j) ;

%p end do:

%p a;

%p end proc:

%p seq(A033716(n),n=0..80) ; # _R. J. Mathar_, Feb 22 2021

%t a[n_] := With[{r = Reduce[x^2 + 3*y^2 == n, {x, y}, Integers]}, Which[r === False, 0, Head[r] === And, 1, True, Length[r]]]; Table[a[n], {n, 0, 101}] (* _Jean-François Alcover_, Jan 10 2014 *)

%t QP = QPochhammer; s = (QP[q^2] * QP[q^6])^5 / (QP[q] * QP[q^3] * QP[q^4] * QP[q^12])^2 + O[q]^100; CoefficientList[s, q] (* _Jean-François Alcover_, Nov 09 2015 *)

%t a[ n_] := Length @ FindInstance[ x^2 + 3 y^2 == n, {x, y}, Integers, 10^9]; (* _Michael Somos_, Sep 03 2016 *)

%t a[ n_] := SeriesCoefficient[ EllipticTheta[ 3, 0, q] EllipticTheta[ 3, 0, q^3], {q, 0, n}]; (* _Michael Somos_, Sep 03 2016 *)

%o (PARI) {a(n) = if( n<1, n==0, qfrep([1, 0; 0, 3], n)[n] * 2)}; /* _Michael Somos_, Jun 05 2005 */

%o (PARI) {a(n) = my(A); if( n<0, 0, A = x * O(x^n); polcoeff( (eta(x^2 + A) * eta(x^6 + A))^5 / (eta(x + A) * eta(x^3 + A) * eta(x^4 + A) * eta(x^12 + A))^2, n))}; /* _Michael Somos_, Jun 05 2005 */

%o (PARI) { a(n) = local(f,B); f=factorint(n); B=1; for(i=1,matsize(f)[1], if(f[i,1]%3==1,B*=f[i,2]+1); if(f[i,1]%3==2,if(f[i,2]%2,return(0)))); if(n%4,2*B,6*B) } \\ _Max Alekseyev_, May 16 2006

%o (PARI) first(n) = {my(res = vector(n + 1)); for(i = 0, sqrtint(n \ 3), for(j = 0, sqrtint(n - 3*i^2), res[3*i^2 + j^2 + 1] += (1<<(!!i + !!j)))); res} \\ _David A. Corneth_, Nov 20 2017

%Y Cf. A093602, A096936, A119395, A129576.

%K nonn,easy

%O 0,2

%A _N. J. A. Sloane_