murkan

Finding the two closest factors of an integer

What are the side lengths of the smallest perimeter rectangle whose side lengths are integers and whose area is x?

Example Output:

Number: 21 First Factor: 3 Second Factor: 7

Number: 22 First Factor: 2 Second Factor: 11

Number: 23 First Factor: 1 Second Factor: 23

Number: 24 First Factor: 4 Second Factor: 6

Number: 25 First Factor: 5 Second Factor: 5

Number: 26 First Factor: 2 Second Factor: 13

Number: 27 First Factor: 3 Second Factor: 9

Number: 28 First Factor: 4 Second Factor: 7

Number: 29 First Factor: 1 Second Factor: 29

Number: 30 First Factor: 5 Second Factor: 6

Number: 31 First Factor: 1 Second Factor: 31

Number: 32 First Factor: 4 Second Factor: 8

GitHub

View Github