As people are asking for tips to solve this puzzle, I could provide pointers to kickstart but not too much to reveal the answer.
Tips
 Change subject of the equation. Make x to become the subject.
In algebra we represent it as x = f(n, y). But this representation is useless to you until you finish change subject.
What is change subject?
https://www.google.com/search?q=math+equation+change+subject

Do you find that the value of y is always within a specific range, from [start] to [end]?
Define [start] and [end] for y. 
Write a forloop, for y = [start] to [end], test whether x is an integer under the given n and y

Within the forloop, if âx is integerâ is TRUE, calculate value of x, then output one line of answer.
Note: Using the test case examples, you may have to test through 100,000 different values of y.
Your testing method has to be efficient to run at least 100k times in a flash.
How can it be so fast like that?
The test result is either TRUE or FALSE only. You do not need to know the true value of x in the test.
Calculate the exact value of x only after confirming x is an integer.
The above is just one possible approach. It does not rule out other algorithms that may run even faster.
Enjoy coding!