Input an integer, find the two closest integers which, when multiplied, equal the input
Ok my problem is of mathematical nature. I have an array of bytes whose length is X, i need to find the two closest numbers which multiplied together equal X. I need to do this because i am bulding a bitmap from an array of bytes and i need to make the bitmap look like a square as much as possible. I am coding this in C# but don' t worry about syntax, any algorithm or pseudo-code will do. Thanks in advance for your help There's probably a better algorithm for this, but off the top of my head: 1) Take the square root of the number X; we'll call it N. 2) Set N equal to the ceiling of N (round up