OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..20163
Phillip Tomas Heikoop, Dimensions of Matrix Subalgebras, Bachelor's Thesis, Worcester Polytechnic Institute (Massachusetts, 2019).
EXAMPLE
32 = 4^2 + 4^2 and 4+4 = 8. Using 5, the best we can do is 32 = 5^2 + 2^2 + 1^2 + 1^2 + 1^2 and 5+2+1+1+1 = 10, so a(32) = 8.
MAPLE
b:= proc(n, i) option remember; `if`(n=0 or i=1, n,
min(seq(b(n-j*i^2, i-1)+j*i, j=0..n/i^2)))
end:
a:= n-> b(n, isqrt(n)):
seq(a(n), n=0..100); # Alois P. Heinz, Jun 30 2015
MATHEMATICA
b[n_, i_] := b[n, i] = If[n == 0 || i == 1, n, Min[Table[b[n - j i^2, i - 1] + j i, {j, 0, n/i^2}]]];
a[n_] := b[n, Sqrt[n] // Floor];
a /@ Range[0, 100] (* Jean-François Alcover, Nov 05 2020, after Alois P. Heinz *)
PROG
(PARI) sslist(n) = {local(r, i, v, t); r=vector(n+1, k, 0); for(k=1, n, v=k; i=1; while(i^2<=k, t=r[k-i^2+1]+i; if(t<v, v=t); i++); r[k+1]=v); r}
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Franklin T. Adams-Watters, Mar 24 2008
STATUS
approved