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.

A217840 Total number of solutions to the equation x^2 + k*y^2 = n with x >= 0, y >= 0, k > 0, or 0 if the number is infinite. Order matters for the equation x^2 + y^2 = n.

Original entry on oeis.org

0, 2, 2, 0, 4, 3, 3, 5, 0, 5, 4, 6, 7, 4, 4, 0, 8, 7, 6, 9, 7, 6, 5, 8, 0, 7, 8, 10, 10, 6, 7, 11, 10, 9, 6, 0, 12, 7, 7, 13, 13, 7, 9, 11, 14, 8, 7, 13, 0, 11, 9, 17, 13, 12, 9, 12, 14, 11, 9, 12, 16, 8, 11, 0, 17, 10, 11, 17, 13, 11, 9, 19, 19, 11, 11, 18, 13, 9, 12, 18, 0, 13, 10, 18, 20, 11, 10, 18, 19, 15, 13, 15, 15, 12, 10, 18, 22, 12, 16, 0
Offset: 1

Views

Author

V. Raman, Oct 16 2012

Keywords

Comments

If the equation x^2 + y^2 = n has two solutions (x, y), (y, x) then they will be counted differently.
No solutions can exist for the values of k > n.
a(n) is the same as A216673(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,
10 = 3^2 + 1^2.
10 = 1^2 + 3^2.
10 = 2^2 + 6*1^2.
10 = 1^2 + 9*1^2.
10 = 0^2 + 10*1^2.
So a(10) = 5. On the other hand, for the sequence A216673, the ordered pair 3^2 + 1^2 and 1^2 + 3^2 will be counted as the same, and so A216673(10) = 4.

Crossrefs

Cf. A216673 (a variant of this sequence, when the order does not matter for the equation x^2 + y^2 = n, i.e., if the equation x^2 + y^2 = n has two solutions (x, y), (y, x) then they will be counted as the same).
Cf. A046951.

Programs

  • PARI
    for(n=1, 100, sol=0; for(k=1, n, for(x=0, n, if((issquare(n-k*x*x)&&n-k*x*x>=0), sol++))); if(issquare(n),print1(0", "),print1(sol", "))) /* V. Raman, Oct 16 2012 */

Formula

a(n) = 0 if n is a square, otherwise a(n) = Sum_{k = 0..sqrt(n)} A046951(n-k^2). - Charlie Neder, Jan 15 2019