In class we found this programming problem, and currently, we have no idea how to solve it.
The positive integer
n
is given. It is known thatn = p * q
, wherep
andq
are primes,p<=q
and|q-k*p|<10^5
for some given positive integerk
. You must findp
andq
.
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.