login
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.
7
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,2
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.
LINKS
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
PROG
(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 */
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.
Sequence in context: A329681 A276275 A128585 * A181615 A141333 A262967
KEYWORD
nonn
AUTHOR
V. Raman, Oct 16 2012
STATUS
approved