OFFSET
1,5
LINKS
T. D. Noe, Table of n, a(n) for n = 1..1000
EXAMPLE
a(17) = 6 because
17 = 4^2 + 1*1^2.
17 = 3^2 + 2*2^2.
17 = 1^2 + 4*2^2.
17 = 3^2 + 8*1^2.
17 = 2^2 + 13*1^2.
17 = 1^2 + 16*1^2.
Therefore there are 6 different values of k for which 17 can be written in the form a^2 + k*b^2.
MATHEMATICA
Table[cnt = 0; Do[b = 1; found = False; While[q = n - k*b^2; ! found && q > 0, If[IntegerQ[Sqrt[q]], cnt++; found = True]; b++], {k, n}]; cnt, {n, 100}] (* T. D. Noe, Sep 11 2012 *)
PROG
(PARI) for(n=1, 100, sol=0; for(k=1, n-1, for(x=1, n, if(issquare(n-k*x*x)&&n-k*x*x>0, sol++; break))); print1(sol", ")) /* V. Raman, Oct 16 2012 */
CROSSREFS
KEYWORD
nonn
AUTHOR
V. Raman, Sep 07 2012
STATUS
approved