I was studying a Target question for Math League competitions, and after a few hours of pondering, I finally came up with the following method of solving the mentioned problem:
For any decimal, it is obvious that to move 4 digits to the left of the decimal point, you multiply by $10^4$. Given in the above question that those 4 digits repeat endlessly, the integer part of the fraction is equal to the following: $$\frac{10^4}{x} - \frac{1}{x}$$ The above follows from the fact that the sequence after the decimal point is the same fraction no matter how many cycles of the digit repetitions you move to the left of the decimal point since it repeats an infinite amount of cycles.
The above expression simplifies to the following: $$\frac{9999}{x}$$ As I mentioned above, for x to be a solution to the problem, $\frac{9999}{x}$ must be an integer. To find a prime that satisfies the condition that it must divide into $9999$ with no remainder, we can simply take the prime factorization of 9999 which is: $$3^2*11*101$$ Then to satisfy the "largest prime number" condition, we must pick $101$ as the solution.
I looked in the key and found that my solution was right, but I feel that I didn't really prove that $101$ was the largest prime or that my algorithm works for all problems of the same class. Therefore, I am asking here for a generalized form that is perhaps more reliable than my method, assuming that there is one.