generates length of sides of closest square and pass fifth test