%I #14 Nov 29 2017 04:14:13
%S 1,2,3,2,4,3,4,4,3,4,5,4,4,5,5,4,5,6,5,5,6,5,7,6,5,7,6,6,7,6,7,7,6,7,
%T 7,6,7,7,7,7,7,7,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 9,9,10,9,9,10,9,10,10,9,10,10,9,10,10
%N The longest side of a minimal rectangle made from n squares.
%C A rectangle is minimal with respect to its longest side.
%F a(k^2 - 1) = k + 1.
%F a(k^2) = k.
%e The longest side of a minimal rectangle of n = 5 squares has side length a(5) = 4:
%e +---+---+---+---+ +---+---+---+---+
%e | 1 | 1 | | | 1 | | 1 |
%e +---+---+ 2 + or +---+ 2 +---+
%e | 1 | 1 | | | 1 | | 1 |
%e +---+---+---+---+ +---+---+---+---+
%e a(6) = 3:
%e +---+---+---+ +---+---+
%e | 1 | 1 | 1 | | 1 | 1 |
%e +---+---+---+ +---+---+
%e | 1 | | or | 1 | 1 |
%e +---+ 2 + +---+---+
%e | 1 | | | 1 | 1 |
%e +---+---+---+ +---+---+
%e a(7) = 4:
%e +---+---+---+---+
%e | 1 | 1 | |
%e +---+---+ 2 +
%e | 1 | 1 | |
%e +---+---+---+---+
%e | | |
%e + 2 + 2 +
%e | | |
%e +---+---+---+---+
%t good[s_, w_] := w == {} || s >= Ceiling[Sqrt[Length[w]]] Max[w]; no1[w_] := Select[w, # > 1 &]; a[n_] := Block[{m = Ceiling@ Sqrt@ n, x, p, ok = False}, While[! ok, Do[p = Select[Sqrt@ IntegerPartitions[m x, {n}, Range[Sqrt@ n]^2], good[x, no1[#]] &]; If[p != {}, ok = True; Print["a[", n, "]=", m, " (", x, " x ", m, ") = ", no1@ First@ p]; ok = True; Break[]], {x, m}]; m++]; m - 1]; Array[a, 100] (* correct at least for n <= 1000, _Giovanni Resta_, Nov 28 2017 *)
%K nonn
%O 1,2
%A _Peter Kagey_, Nov 26 2017
%E More terms from _Giovanni Resta_, Nov 28 2017