I am trying to find the dividers of a number that are the pair that most likely represent a square
Take the number 36 for example, this can be calculated from
1*36, 2*18, 3*12, 4*9, 6*6.
And the number 72 can be calculated from
1*72, 2*36, 3*24, 4*18, 6*12, 8*9
For 36 the multipliers of 6*6 equate to a square
and for 72 the the multipliers of 8*9 equate to a the closest square like rectangle
I am looking for a way to calculate this rather than having to write out all multiples to work it out myself.
You can take the square root of the number that you are working with and take its integer component. Then find the closest integer to this value that divides the number you started with.
For example, if $x=36$, then $\sqrt{36}=6$, and we know $6$ is a divisor of $36$ and you are done.
For $x=72$, $\sqrt{72}\approx8.4$. So take $8$ which is the integer component of $8.4$. In this case $8$ divides 72 and your done.
For another example, consider $x=84$. Again the integer component of $\sqrt{84}$ is $9$. This time $7$ is the closest number to 9 that divides $84$, and $\frac{84}{7}=12$, so you get the pair $(7,12)$.