Minimum perimeter of an area Just a simple code golf function for fun, intentionally left open with few rules to see what creativity comes up.

Input: An integer representing the area of a rectangle.

Output: Two integers representing the side lengths of the rectangle that have the least perimeter for the area.  (In any order.)

Test cases:

25 =&gt; 5, 5
53 =&gt; 53, 1
4294967295 =&gt; 65537, 65535
Mathematica 34 26

Besides the explicit search there is a nice convergent series:



n = 27

{i=√n//.i_:&gt;n/⌈n/⌊i⌋⌉,n/i}



  {3, 9}


Three previous approaches with 34 characters:

{#,n/#}&amp;@FixedPoint[n/⌈n/⌊#⌋⌉&amp;,√n]

For[i=√n,i&gt;(i=n/⌈n/⌊i⌋⌉),];{i,n/i}

f@i_:=f[f@i=n/⌈n/⌊i⌋⌉]
{i=f@√n,n/i}

ClearAll[f]


Visualization:

p = FixedPointList[n/⌈n/⌊#⌋⌉ &amp;, Sqrt[n]];

Plot[n/x, {x, 0, 11}, GridLines -&gt; {Range@n, Range@n}, 
 AspectRatio -&gt; Automatic, PlotRange -&gt; {{0, 10.2}, {0, 7.2}}, 
 Epilog -&gt; {Red, Thickness[0.005], 
   Arrow[Transpose[{{n/p, ⌈p⌉}, {n/p, ⌊p⌋}, {⌈n/⌊p⌋⌉, ⌊p⌋}}, {2, 3, 1}]], 
  PointSize[0.02], Black, Point[{n/p[[-1]], p[[-1]]}]}]