cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A351061 Smallest positive integer whose square can be written as the sum of n positive perfect squares.

This page as a plain text file.
%I A351061 #16 May 14 2022 11:22:31
%S A351061 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,
%T A351061 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,
%U A351061 9,9,10,9,9,10,9,10,10,9,10,10,9,10,10,10
%N A351061 Smallest positive integer whose square can be written as the sum of n positive perfect squares.
%C A351061 Shortest possible integer length of the diagonal of an n-dimensional hyperrectangle where each edge has a positive integer length.
%H A351061 Alois P. Heinz, <a href="/A351061/b351061.txt">Table of n, a(n) for n = 1..10000</a>
%F A351061 a(n) = sqrt(A215539(n)). - _Jinyuan Wang_, Jan 30 2022
%e A351061 a(1) = 1 because 1^2 = 1^2.
%e A351061 a(2) = 5 because 5^2 = 3^2 + 4^2.
%e A351061 a(3) = 3 because 3^2 = 1^2 + 2*(2^2).
%e A351061 a(4) = 2 because 2^2 = 4*(1^2).
%e A351061 a(5) = 4 because 4^2 = 3*(1^2) + 2^2 + 3^2.
%e A351061 a(6) = 3 because 3^2 = 5*(1^2) + 2^2.
%e A351061 a(7) = 4 because 4^2 = 4*(1^2) + 3*(2^2).
%p A351061 b:= proc(n, i, t) option remember; n>=t and (n=t or
%p A351061       (i>0 and (b(n, i-1, t) or i^2<=n and b(n-i^2, i, t-1))))
%p A351061     end:
%p A351061 a:= proc(n) option remember; local k;
%p A351061       for k while not b(k^2, k, n) do od; k
%p A351061     end:
%p A351061 seq(a(n), n=1..100);  # _Alois P. Heinz_, Jan 31 2022
%t A351061 b[n_, i_, t_] := b[n, i, t] = n >= t && (n == t ||
%t A351061      (i > 0 && (b[n, i - 1, t] || i^2 <= n && b[n - i^2, i, t - 1])));
%t A351061 a[n_] := a[n] = Module[{k}, For[k = 1, !b[k^2, k, n], k++]; k];
%t A351061 Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, May 14 2022, after _Alois P. Heinz_ *)
%Y A351061 Cf. A215539.
%K A351061 nonn
%O A351061 1,2
%A A351061 _Lee A. Newberg_, Jan 30 2022
%E A351061 More terms from _Jinyuan Wang_, Jan 30 2022