%I #18 Jan 31 2022 08:46:58
%S 1,25,9,4,16,9,16,16,9,16,25,36,16,25,36,16,25,36,25,36,36,25,49,36,
%T 25,49,36,36,49,36,49,49,36,49,49,36,49,49,64,49,49,64,49,64,64,49,64,
%U 64,49,64,81,64,64,81,64,64,81,64,81,81,64,81,81,64,81,81
%N First square that can be represented as the sum of n nonzero squares.
%H Alois P. Heinz, <a href="/A215539/b215539.txt">Table of n, a(n) for n = 1..10000</a>
%e a(1) = 1 = 1^2.
%e a(2) = 25 = 3^2 + 4^2.
%e a(3) = 9 = 1^2 + 2*2^2.
%e a(4) = 4 = 4*1^2.
%e a(5) = 16 = 3*1^2 + 2^2 + 3^2.
%e a(6) = 9 = 5*1^2 + 2^2.
%e a(7) = 16 = 4*1^2 + 3*2^2.
%p b:= proc(n, i, t) option remember; n>=t and (n=t or
%p (i>0 and (b(n, i-1, t) or i^2<=n and b(n-i^2, i, t-1))))
%p end:
%p a:= proc(n) option remember; local k;
%p for k while not b(k^2, k, n) do od; k^2
%p end:
%p seq(a(n), n=1..100); # _Alois P. Heinz_, Aug 26 2012
%t b[n_, i_, t_] := b[n, i, t] = n >= t && (n == t || (i > 0 && (b[n, i - 1, t] || i^2 <= n && b[n - i^2, i, t - 1])));
%t a[n_] := a[n] = Module[{k}, For[k = 1, !b[k^2, k, n], k++]; k^2];
%t Array[a, 100] (* _Jean-François Alcover_, Nov 22 2020, after _Alois P. Heinz_ *)
%K nonn
%O 1,2
%A _Jon Perry_, Aug 15 2012
%E More terms from _Alois P. Heinz_, Aug 26 2012