[go: up one dir, main page]

login
A138554
Minimal value of sum k_i when sum (k_i)^2 = n.
3
0, 1, 2, 3, 2, 3, 4, 5, 4, 3, 4, 5, 6, 5, 6, 7, 4, 5, 6, 7, 6, 7, 8, 9, 8, 5, 6, 7, 8, 7, 8, 9, 8, 9, 8, 9, 6, 7, 8, 9, 8, 9, 10, 11, 10, 9, 10, 11, 12, 7, 8, 9, 10, 9, 10, 11, 12, 11, 10, 11, 12, 11, 12, 13, 8, 9, 10, 11, 10, 11, 12, 13, 12, 11, 12, 13, 14, 13, 14, 15, 12, 9, 10, 11, 12, 11
OFFSET
0,3
LINKS
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
STATUS
approved