In class we found this programming problem, and currently, we have no idea how to solve it.
The positive integer
nis given. It is known thatn = p * q, wherepandqare primes,p<=qand|q-k*p|<10^5for some given positive integerk. You must findpandq.
Input:
35 1
121 1
1000730021 9
Output:
5 * 7
11 * 11
10007 * 100003
It's not homework, we are just trying to solve some interesting problems. If you have some ideas, please post them here so we can try something, thanks.