login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A351061
Smallest positive integer whose square can be written as the sum of n positive perfect squares.
2
1, 5, 3, 2, 4, 3, 4, 4, 3, 4, 5, 6, 4, 5, 6, 4, 5, 6, 5, 6, 6, 5, 7, 6, 5, 7, 6, 6, 7, 6, 7, 7, 6, 7, 7, 6, 7, 7, 8, 7, 7, 8, 7, 8, 8, 7, 8, 8, 7, 8, 9, 8, 8, 9, 8, 8, 9, 8, 9, 9, 8, 9, 9, 8, 9, 9, 9, 10, 9, 9, 10, 9, 9, 10, 9, 10, 10, 9, 10, 10, 9, 10, 10, 10
OFFSET
1,2
COMMENTS
Shortest possible integer length of the diagonal of an n-dimensional hyperrectangle where each edge has a positive integer length.
LINKS
FORMULA
a(n) = sqrt(A215539(n)). - Jinyuan Wang, Jan 30 2022
EXAMPLE
a(1) = 1 because 1^2 = 1^2.
a(2) = 5 because 5^2 = 3^2 + 4^2.
a(3) = 3 because 3^2 = 1^2 + 2*(2^2).
a(4) = 2 because 2^2 = 4*(1^2).
a(5) = 4 because 4^2 = 3*(1^2) + 2^2 + 3^2.
a(6) = 3 because 3^2 = 5*(1^2) + 2^2.
a(7) = 4 because 4^2 = 4*(1^2) + 3*(2^2).
MAPLE
b:= proc(n, i, t) option remember; n>=t and (n=t or
(i>0 and (b(n, i-1, t) or i^2<=n and b(n-i^2, i, t-1))))
end:
a:= proc(n) option remember; local k;
for k while not b(k^2, k, n) do od; k
end:
seq(a(n), n=1..100); # Alois P. Heinz, Jan 31 2022
MATHEMATICA
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])));
a[n_] := a[n] = Module[{k}, For[k = 1, !b[k^2, k, n], k++]; k];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, May 14 2022, after Alois P. Heinz *)
CROSSREFS
Cf. A215539.
Sequence in context: A372389 A040022 A165100 * A159935 A165102 A294568
KEYWORD
nonn
AUTHOR
Lee A. Newberg, Jan 30 2022
EXTENSIONS
More terms from Jinyuan Wang, Jan 30 2022
STATUS
approved