login
A216674
Total number of solutions to the equation x^2+k*y^2 = n with x > 0, y > 0, k >= 0, or 0 if infinite. (Order does not matter for the equation x^2+y^2 = n).
6
0, 1, 1, 0, 2, 2, 2, 3, 0, 3, 3, 4, 5, 3, 3, 0, 6, 5, 5, 6, 6, 5, 4, 6, 0, 5, 6, 8, 8, 5, 6, 8, 9, 7, 5, 0, 10, 6, 6, 10, 11, 6, 8, 9, 11, 7, 6, 10, 0, 8, 8, 14, 11, 10, 8, 10, 13, 9, 8, 10, 14, 7, 9, 0, 14, 9, 10, 14, 12, 10, 8, 15, 17, 9, 9, 16, 12, 8, 11, 14, 0
OFFSET
1,5
COMMENTS
If the equation x^2+y^2 = n has got two solutions (x, y), (y, x) then they will be counted only once.
No solutions can exist for the values of k >= n.
This sequence differs from A216505 in the fact that this sequence gives the total number of solutions to the equation x^2+k*y^2 = n, whereas the sequence A216505 gives the number of distinct values of k for which a solution to the equation x^2+k*y^2 = n can exist.
Some values of k can clearly have more than one solution.
For example, x^2+k*y^2 = 33 is satisfiable for
33 = 1^2+2*4^2.
33 = 5^2+2*2^2.
33 = 3^2+6*2^2.
33 = 1^2+8*2^2.
33 = 5^2+8*1^2.
33 = 4^2+17*1^2.
33 = 3^2+24*1^2.
33 = 2^2+29*1^2.
33 = 1^2+32*1^2.
So for this sequence a(33) = 9.
On the other hand, for the sequence A216505, there exist only 7 different values of k for which a solution to the equation mentioned above exists.
So A216505(33) = 7.
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
PROG
(PARI) a(n)=if(issquare(n), return(0)); sum(y=ceil(sqrt(n/2-1/4)), sqrtint(n-1), issquare(n-y^2))+sum(k=2, n-1, sum(y=1, sqrtint((n-1)\k), issquare(n-k*y^2))) \\ Charles R Greathouse IV, Sep 14 2012
(PARI) for(n=1, 100, sol=0; for(k=0, n, for(x=1, n, if((issquare(n-k*x*x)&&n-k*x*x>0&&k>=2)||(issquare(n-x*x)&&n-x*x>0&&k==1&&x*x<=n-x*x), sol++))); if(issquare(n), print1(0", "), print1(sol", "))) /* V. Raman, Oct 16 2012 */
CROSSREFS
Cf. A217956 (a variant of this sequence, when the order does matter for the equation x^2+y^2 = n, i.e. if the equation x^2+y^2 = n has got two solutions (x, y), (y, x) then they will be counted separately).
Sequence in context: A308119 A307299 A307298 * A106795 A162203 A071455
KEYWORD
nonn
AUTHOR
V. Raman, Sep 13 2012
EXTENSIONS
Ambiguity in name corrected by V. Raman, Oct 16 2012
STATUS
approved