Rectangle of a Given Area

Background

The idea for this task came from a GCSE Maths past paper that asked students to draw (on a grid) a rectangle with an area of 21cm². The key to doing this is to factorise the area - e.g. 21 is 7 x 3, so a rectangle that measures 7cm by 3cm will have an area of 21cm².

If you'd like a diagram to help you to see what's going on, then I have created another page to help you to visualise the concept.

Your Task

Create a function that:

As an extension you might like to return the dimensions of the squarest rectangle, or the one with the longest perimeter.