For numbers like 1007, where the factors are not clear, the following strategy should be employed.
Suppose we want to find the factors of 1007, now we know 1007 can be written as x*y (x, y != 1 or 1007) if 1007 has some prime factor. It is not very hard to see that both x and y cannot be greater than $\left \lfloor \sqrt{1007} \right \rfloor$ because if both are greater than $\left \lfloor \sqrt{1007} \right \rfloor$ then x*y > 1007 but x*y = 1007.
So one of them has to be less than $\left \lfloor \sqrt{1007} \right \rfloor$ . Now if we can find which is this no. less than $\left \lfloor \sqrt{1007} \right \rfloor$, we can determine x*y. Here $\left \lfloor \sqrt{1007} \right \rfloor$ = 31. So, we check for divisibility with 31,29,23,19. We find 1007 is divisible by 19 and = 19*53. We know 53 is prime. So 1007 = 19*53.