OFFSET
1,2
LINKS
Eric Weisstein's World of Mathematics, Lagrange's Four-Square Theorem.
Eric Weisstein's World of Mathematics, Sum of Squares Function.
FORMULA
a(n) = Sum_{i=0..k} ceiling(10^n/2^(2*i+3) - 7/8) with minimal k for which ceiling(10^n/2^(2*k+3) - 7/8) = 0.
EXAMPLE
a(1) = 1 since 7 is the only natural number below 10 which is the sum of 4 but no fewer nonzero squares.
MAPLE
a:=proc(n)
local f, s, k;
f:=(x, y)->ceil(10^y/2^(2*x+3)-7/8):
s:=0:
for k from 0 by 1 while not f(k, n)=0 do
s:=s+f(k, n);
od:
return(s);
end;
MATHEMATICA
a[n_] := Module[{f, s = 0, k}, f[x_, y_] := Ceiling[10^y/2^(2x+3) - 7/8]; For[k = 0, f[k, n] != 0, k++, s += f[k, n]]; Return[s]];
Array[a, 20] (* Jean-François Alcover, Oct 31 2020, after Maple *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Martin Renner, Jan 18 2011
STATUS
approved