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.

Showing 1-8 of 8 results.

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

A216282 Number of nonnegative solutions to the equation x^2 + 2*y^2 = n.

Original entry on oeis.org

1, 1, 1, 1, 0, 1, 0, 1, 2, 0, 1, 1, 0, 0, 0, 1, 1, 2, 1, 0, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 1, 2, 1, 0, 2, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 2, 0, 0, 2, 0, 0, 2, 0, 1, 0, 0, 0, 0, 1, 0, 2, 1, 1, 0, 0, 0, 2, 1, 0, 1, 1, 0, 0, 0, 0, 3, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 3, 1, 0, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0, 1, 0, 0
Offset: 1

Views

Author

V. Raman, Sep 03 2012

Keywords

Comments

Records occur at 1, 9, 81, 297, 891, 1683, 5049, 15147, 31977, ... - Antti Karttunen, Aug 23 2017

Examples

			For n = 9, there are two solutions: 9 = 9^2 + 2*(0^2) = 1^2 + 2*(2^2), thus a(9) = 2.
For n = 81, there are three solutions: 81 = 9^2 + 2*(0^2) = 3^2 + 2*(6^2) = 7^2 + 2*(4^2), thus a(81) = 3.
For n = 65536, there is one solution: 65536 = 256^2 + 2*(0^2) = 65536 + 0, thus a(65536) = 1.
For n = 65537, there is one solution: 65537 = 255^2 + 2*(16^2) = 65205 + 512, thus a(65537) = 1.
		

Crossrefs

Cf. A002479 (positions of nonzeros), A097700 (of zeros).

Programs

  • Mathematica
    r[n_] := Reduce[x >= 0 && y >= 0 && x^2 + 2 y^2 == n, Integers];
    a[n_] := Which[rn = r[n]; rn === False, 0, Head[rn] === And, 1, Head[rn] === Or, Length[rn], True, -1];
    Table[a[n], {n, 1, 120}] (* Jean-François Alcover, Jun 24 2017 *)
  • Scheme
    (define (A216282 n) (cond ((< n 2) 1) (else (let loop ((k (- (A000196 n) (modulo (- n (A000196 n)) 2))) (s 0)) (if (< k 0) s (let ((x (/ (- n (* k k)) 2))) (loop (- k 2) (+ s (A010052 x))))))))) ;; Antti Karttunen, Aug 23 2017

Extensions

Examples from Antti Karttunen, Aug 23 2017

A216283 Number of nonnegative solutions to the equation x^2+5*y^2 = n.

Original entry on oeis.org

1, 0, 0, 1, 1, 1, 0, 0, 2, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 2, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 2, 1, 0, 0, 2, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 2, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1
Offset: 1

Views

Author

V. Raman, Sep 03 2012

Keywords

Comments

Records occur at 1, 9, 81, 189, 441, 1449, 3969, 12789, 13041, 30429, ... - Antti Karttunen, Aug 23 2017

Examples

			For n = 9, there are two solutions: 9 = 3^2 + 5*(0^2) = 2^2 + 5*(1^2), thus a(9) = 2.
For n = 81, there are three solutions: 81  = 9^2 + 5*(0^2) = 6^2 + 5*(3^2) = 1^2 + 5*(4^2), thus a(81) = 3.
		

Crossrefs

Cf. A033718 (all solutions x^2+5*y^2 = n).
Cf. A020669 (positions of nonzeros).

Programs

  • PARI
    N=666;  x='x+O('x^N);
    T(x)=sum(n=0,ceil(sqrt(N)),x^(n*n));
    Vec(T(x)*T(x^5))
    /* Joerg Arndt, Sep 21 2012 */
    
  • Scheme
    (define (A216283 n) (cond ((< n 2) 1) (else (let loop ((k (A000196 n)) (s 0)) (if (< k 0) s (let ((x (- n (* k k)))) (loop (- k 1) (+ s (if (zero? (modulo x 5)) (A010052 (/ x 5)) 0))))))))) ;; Antti Karttunen, Aug 23 2017

Formula

G.f. T(x) * T(x^5) where T(x) = sum(n>=0, x^(n^2) ). - Joerg Arndt, Sep 21 2012

Extensions

Examples from Antti Karttunen, Aug 23 2017

A216278 Number of solutions to the equation x^2+2y^2 = n with x and y > 0.

Original entry on oeis.org

0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 2, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 2, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 2, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 3, 0, 0, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0, 1, 0, 0
Offset: 1

Views

Author

V. Raman, Sep 03 2012

Keywords

Crossrefs

Programs

  • Mathematica
    r[n_] := Reduce[x > 0 && y > 0 && x^2 + 2 y^2 == n, Integers];
    a[n_] := Which[rn = r[n]; rn === False, 0, Head[rn] === And, 1, Head[rn] === Or, Length[rn], True, -1];
    Table[a[n], {n, 1, 120}] (* Jean-François Alcover, Jun 24 2017 *)

A216279 Number of solutions to the equation x^2+5y^2 = n with x and y > 0.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1
Offset: 1

Views

Author

V. Raman, Sep 03 2012

Keywords

Crossrefs

Programs

  • PARI
    a(n)=sum(k=1,sqrtint((n-1)\5), issquare(n-5*k^2)) \\ Charles R Greathouse IV, Jun 06 2016
    
  • PARI
    list(lim)=my(v=vector(lim\1),t); for(y=1,sqrtint((#v-1)\5), t=5*y^2; for(x=1,sqrtint(#v-t), v[x^2+t]++)); v \\ Charles R Greathouse IV, Jun 06 2016

A374286 a(n) is the smallest nonnegative integer k where there are exactly n nonnegative integer solutions to x^2 + 3*y^2 = k.

Original entry on oeis.org

2, 0, 4, 28, 1729, 196, 364, 1529437, 9604, 2548, 593047, 470596, 6916, 68574961, 33124, 124852, 1983163
Offset: 0

Views

Author

Seiichi Manyama, Jul 02 2024

Keywords

Comments

a(n) is the smallest nonnegative k such that A119395(k) = n.
a(18) = 48412.
a(20) = 18384457.
a(21) = 6117748.
a(23) = 1623076.
a(24) = 214396.
a(27) = 629356.
a(30) = 2372188.
a(32) = 79530724.
a(36) = 1500772.
a(41) = 11957764.
a(42) = 116237212.

Crossrefs

Programs

  • PARI
    b(n, k) = sum(i=0, sqrtint(n), sum(j=0, sqrtint(n\k), i^2+k*j^2==n));
    a(n, k=3) = my(cnt=0); while(b(cnt, k)!=n, cnt++); cnt;

A217462 a(n) is the sum of total number of nonnegative integer solutions to each of a^2 + b^2 = n, a^2 + 2*b^2 = n, a^2 + 3*b^2 = n and a^2 + 7*b^2 = n. (Order does not matter for the equation a^2+b^2 = n).

Original entry on oeis.org

4, 2, 2, 5, 1, 1, 2, 3, 5, 1, 2, 3, 2, 0, 0, 6, 2, 3, 2, 1, 1, 1, 1, 1, 5, 1, 3, 4, 2, 0, 1, 4, 2, 2, 0, 6, 3, 1, 1, 1, 2, 0, 3, 2, 1, 0, 0, 3, 5, 3, 2, 4, 2, 2, 0, 1, 3, 1, 1, 0, 2, 0, 2, 7, 2, 2, 3, 2, 0, 0, 1, 4, 3, 1, 2, 4, 1, 0, 2, 1, 6, 2, 1, 3, 2, 1, 0, 3, 2, 1, 2, 1, 1, 0, 0, 1, 3, 2, 4, 6
Offset: 1

Views

Author

V. Raman, Oct 04 2012

Keywords

Comments

Note: For the equation a^2 + b^2 = n, if there are two solutions (a,b) and (b,a), then they will be counted only once.
The sequences A216501 and A216671 give how many of the four k values, k = 1, 2, 3, 7 does the equation a^2 + k*b^2 = n have a solution to.
1, 2, 3, 7 are the first four numbers, with the class number 1.
"If a composite number C is of the form a^2 + kb^2 for some integers a & b, then every prime factor of C raised to an odd power is of the form c^2 + kd^2 for some integers c & d."
This statement is only true for k = 1, 2, 3.
For k = 7, with the exception of the prime factor 2, the statement mentioned above is true.
A number can be written as a^2 + b^2 if and only if it has no prime factor congruent to 3 (mod 4) raised to an odd power.
A number can be written as a^2 + 2b^2 if and only if it has no prime factor congruent to 5 (mod 8) or 7 (mod 8) raised to an odd power.
A number can be written as a^2 + 3b^2 if and only if it has no prime factor congruent to 2 (mod 3) raised to an odd power.
A number can be written as a^2 + 7b^2 if and only if it has no prime factor congruent to 3 (mod 7) or 5 (mod 7) or 6 (mod 7) raised to an odd power, and the exponent of 2 is not 1.

References

  • David A. Cox, Primes of the Form x^2 + n y^2, Wiley, 1989.

Crossrefs

Cf. A217868 (related sequence of this when the order does matter for the equation a^2 + b^2 = n).
Cf. A216501 (how many of the four k values, k = 1, 2, 3, 7 does the equation a^2 + k*b^2 = n have a solution to, with a > 0, b > 0).
Cf. A216671 (how many of the four k values, k = 1, 2, 3, 7 does the equation a^2 + k*b^2 = n have a solution to, with a >= 0, b >= 0).
Cf. A000161 (number of solutions to n = a^2+b^2 (when the solutions (a, b) and (b, a) are being counted as the same) with a >= 0, b >= 0).
Cf. A216282 (number of solutions to n = a^2+2*b^2 with a >= 0, b >= 0).
Cf. A119395 (number of solutions to n = a^2+3*b^2 with a >= 0, b >= 0).
Cf. A216512 (number of solutions to n = a^2+7*b^2 with a >= 0, b >= 0).

Programs

  • PARI
    for(n=1,100,sol=0;for(x=0,100,if(issquare(n-x*x)&&n-x*x>=0&&x*x<=n-x*x,sol++);if(issquare(n-2*x*x)&&n-2*x*x>=0,sol++);if(issquare(n-3*x*x)&&n-3*x*x>=0,sol++);if(issquare(n-7*x*x)&&n-7*x*x>=0,sol++));printf(sol","))

A217868 a(n) is the sum of total number of nonnegative integer solutions to each of a^2 + b^2 = n, a^2 + 2*b^2 = n, a^2 + 3*b^2 = n and a^2 + 7*b^2 = n. (Order matters for the equation a^2+b^2 = n).

Original entry on oeis.org

5, 2, 2, 6, 2, 1, 2, 3, 6, 2, 2, 3, 3, 0, 0, 7, 3, 3, 2, 2, 1, 1, 1, 1, 7, 2, 3, 4, 3, 0, 1, 4, 2, 3, 0, 7, 4, 1, 1, 2, 3, 0, 3, 2, 2, 0, 0, 3, 6, 4, 2, 5, 3, 2, 0, 1, 3, 2, 1, 0, 3, 0, 2, 8, 4, 2, 3, 3, 0, 0, 1, 4, 4, 2, 2, 4, 1, 0, 2, 2, 7, 3, 1, 3, 4, 1, 0, 3, 3, 2, 2, 1, 1, 0, 0, 1, 4, 2, 4, 8
Offset: 1

Views

Author

V. Raman, Oct 13 2012

Keywords

Comments

Note: For the equation a^2 + b^2 = n, if there are two solutions (a,b) and (b,a), then they will be counted separately.
The sequences A216501 and A216671 give how many of the four k values, k = 1, 2, 3, 7 does the equation a^2 + k*b^2 = n have a solution to.
1, 2, 3, 7 are the first four numbers with class number 1.
a(n) = A217462(n) when n is not the sum of two positive squares.
But when n is the sum of two positive squares, the ordered pairs for the equation x^2+y^2 = n count.
For example,
193 = 12^2 + 7^2.
193 = 7^2 + 12^2.
193 = 11^2 + 2*6^2.
193 = 1^2 + 3*8^2.
193 = 9^2 + 7*4^2.
So a(193) = 5. On the other hand, for the sequence A217462, the ordered pairs 12^2 + 7^2, 7^2 + 12^2 will be counted only once, so A217462(193) = 4.

References

  • David A. Cox, Primes of the Form x^2 + n y^2, Wiley, 1989.

Crossrefs

Cf. A217462 (related sequence of this when the order does not matter for the equation a^2 + b^2 = n).
Cf. A216501 (how many of the four k values, k = 1, 2, 3, 7 does the equation a^2 + k*b^2 = n have a solution to, with a > 0, b > 0).
Cf. A216671 (how many of the four k values, k = 1, 2, 3, 7 does the equation a^2 + k*b^2 = n have a solution to, with a >= 0, b >= 0).
Cf. A000925 (number of solutions to n = a^2+b^2 (when the solutions (a, b) and (b, a) are being counted differently) with a >= 0, b >= 0).
Cf. A216282 (number of solutions to n = a^2+2*b^2 with a >= 0, b >= 0).
Cf. A119395 (number of solutions to n = a^2+3*b^2 with a >= 0, b >= 0).
Cf. A216512 (number of solutions to n = a^2+7*b^2 with a >= 0, b >= 0).

Programs

  • PARI
    for(n=1, 100, sol=0; for(x=0, 100, if(issquare(n-x*x)&&n-x*x>=0, sol++); if(issquare(n-2*x*x)&&n-2*x*x>=0, sol++); if(issquare(n-3*x*x)&&n-3*x*x>=0, sol++); if(issquare(n-7*x*x)&&n-7*x*x>=0, sol++)); printf(sol", "))
Showing 1-8 of 8 results.