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-5 of 5 results.

A218799 Number of solutions to x^2 + 2y^2 = n^2.

Original entry on oeis.org

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

Views

Author

Jon Perry, Nov 06 2012

Keywords

Comments

a(3k) > 1 for all k > 0 because k^2 + 2(2k)^2 = (3k)^2.
Terms with index n^2 in A216282. - Joerg Arndt, Nov 06 2012

Examples

			a(9) = 3 because we have 9^2 + 2*0^2 = 9^2, 3^2 + 2*6^2 = 9^2 and 7^2 + 2*4^2 = 9^2 and no others.
		

Crossrefs

Programs

  • JavaScript
    for (i=0;i<100;i++) {
    d=0;e=0;
    for (a=0;a<=i;a++)
    for (b=0;b<=i;b++) {
    if (Math.pow(a,2)+2*Math.pow(b,2)
    				
  • Mathematica
    nn = 87; t = Sort[Select[Flatten[Table[x^2 + 2*y^2, {x, 0, nn}, {y, 0, nn}]], # <= nn^2 &]]; Table[Count[t, ?(# == n^2 &)], {n, 0, nn}] (* _T. D. Noe, Nov 06 2012 *)

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

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

Original entry on oeis.org

5, 0, 9, 81, 297, 891, 1683, 8019, 5049, 18513, 15147, 88209, 31977, 1185921, 136323, 166617, 95931, 7144929, 351747
Offset: 0

Views

Author

Seiichi Manyama, Jul 02 2024

Keywords

Comments

For n > 1, a(n) is the smallest nonnegative k such that A216282(k) = n.
a(20) = 287793.
a(21) = 1499553.
a(22) = 11042163.
a(23) = 2832489.
a(24) = 863379.
a(25) = 20160657.
a(26) = 99379467.
a(27) = 5979699.
a(28) = 2590137.
a(30) = 3165723.
a(32) = 3933171.
a(33) = 121463793.
a(35) = 181445913.
a(36) = 9497169.

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=2) = 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-5 of 5 results.