Haskell Min Perimeter Rectangle
minPerimeterRectangle :: Int -> Int
minPerimeterRectangle n = go 1 maxBound
  where
    go i best
      | i * i >= n = best
      | otherwise  = go (i + 1) newBest
      where
        newBest = if n `mod` i == 0 then min best (2 * (i + n `div` i)) else best

This searches factor pairs up to the square root and picks the pair with the smallest perimeter.