Posted by Leslie on Friday, December 30, 2011 at 10:26pm.
For small numbers, just try every prime less than the square root. Why stop there, because if there are two factors, and one is greater than the square root, the ther must be less than the square root, and you will already have tried it.
For example try 2 as a factor of 84.
84 = 2*42
Now, try 2 as a factor of 42.
84 = 2*2*21
Since 21 is odd, it will have no even factors. So, try 3, the next prime.
84 = 2*2*3*7
Since 7, the largest remaining factor, is prime, we're done.