The goal is to find a generalized way to express a number as product of its factors, whose difference is close to zero.
For example,
n = 12;
12 = 3*4 (or) 2*6 (or) 12*1
The factors which are close to each other are 3 & 4.
Likewise, how do I find for a number 'N'?
I came across this question in a book, however I didn't find the solution anywhere.
Start from $\lfloor\sqrt{N}\rfloor$ and check every integer before it ($\lfloor\sqrt{N}\rfloor-1,\lfloor\sqrt{N}\rfloor-2,\cdots$) until you get a factor of $N$. Thus if $a$ is the largest factor of $N$, $\leq\lfloor\sqrt{N}\rfloor$, then $N=a\times\frac{N}{a}$ is the desired factorization.