I would like to decompose $N$ into $A$ and $B$ so that $A$ and $B$ are close to each other. Even I would allow some small error. Se I would like to have:
$$N = A*B + \epsilon_N$$
where
$$\epsilon_N < A, \epsilon_N < B$$
and I would like to minimise
$$|A - B|$$
The underling application is to find number of rows and columns for N elements so that the matrix is as close to square as possible.