OFFSET
1,2
COMMENTS
LINKS
EXAMPLE
a(1) = 1 = 1^2.
a(2) = 50 = 1^2+7^2 = 5^2+5^2.
a(3) = 54 = 2^2+2*5^2 = 2*3^2+6^2 = 1^2+2^2+7^2.
a(11) = 65 = 3*1^2+2*2^2+6*3^2 = 2*1^2+5*2^2+3*3^2+4^2 = 1^2+8*2^2+2*4^2 = 6*1^2+3*3^2+2*4^2 = 5*1^2+3*2^2+3*4^2 = 10*2^2+5^2 = 5*1^2+2*2^2+3*3^2+5^2 = 4*1^2+5*2^2+4^2+5^2 = 8*1^2+2*4^2+5^2 = 7*1^2+2*2^2+2*5^2 = 7*1^2+2^2+2*3^2+6^2 = 8*1^2+2*2^2+7^2.
MAPLE
b:= proc(n, i, t) option remember; `if`(n<t, 0, `if`(n=t, 1,
`if`(t=0, 0, `if`(i>0, b(n, i-1, t), 0)+
`if`(i^2>n, 0, b(n-i^2, i, t-1)))))
end:
a:= proc(n) local k;
for k while b(k, isqrt(k), n)<n do od; k
end:
seq(a(n), n=1..100);
MATHEMATICA
b[n_, i_, t_] := b[n, i, t] = If[n < t, 0, If[n == t, 1, If[t == 0, 0, If[i > 0, b[n, i-1, t], 0] + If[i^2 > n, 0, b[n-i^2, i, t-1]]]]]; a[n_] := Module[{k}, For[k = 1, b[k, Sqrt[k] // Floor, n] < n, k++]; k]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Dec 30 2013, translated from Maple *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Aug 26 2012
STATUS
approved