cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

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, 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, 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
Offset: 0

Views

Author

Keywords

Comments

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
The number of nonnegative solutions is given by A119395. - Max Alekseyev, May 16 2006
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

Examples

			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 + ...
		

References

  • J. M. Borwein, P. B. Borwein, Pi and the AGM, Wiley, 1987, p. 110.
  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p 102 eq 9.
  • N. J. Fine, Basic Hypergeometric Series and Applications, Amer. Math. Soc., 1988; p. 78, Eq. (32.25).

Crossrefs

Programs

  • Maple
    A033716 := proc(n)
        local a,j ;
        a := 0 ;
        for j from 0 to n/3 do
            a := a+A000122(n-3*j)*A000122(j) ;
        end do:
        a;
    end proc:
    seq(A033716(n),n=0..80) ; # R. J. Mathar, Feb 22 2021
  • Mathematica
    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 *)
    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 *)
    a[ n_] := Length @ FindInstance[ x^2 + 3 y^2 == n, {x, y}, Integers, 10^9]; (* Michael Somos, Sep 03 2016 *)
    a[ n_] := SeriesCoefficient[ EllipticTheta[ 3, 0, q] EllipticTheta[ 3, 0, q^3], {q, 0, n}]; (* Michael Somos, Sep 03 2016 *)
  • PARI
    {a(n) = if( n<1, n==0, qfrep([1, 0; 0, 3], n)[n] * 2)}; /* Michael Somos, Jun 05 2005 */
    
  • 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 */
    
  • 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
    
  • 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

Formula

Fine gives an explicit formula for a(n) in terms of the divisors of n.
Coefficients in expansion of Sum_{ i, j = -inf .. inf } q^(i^2+3*j^2).
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]
Euler transform of period 12 sequence [ 2, -3, 4, -1, 2, -6, 2, -1, 4, -3, 2, -2, ...]. - Michael Somos, Feb 17 2003
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
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
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
a(n) = 2 * A096936(n).
a(3*n + 2) = 0. a(3*n) = a(n). a(3*n + 1) = 2 * A129576(n). - Michael Somos, Sep 03 2016
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Pi/sqrt(3) = 1.813799... (A093602). - Amiram Eldar, Oct 15 2022