The question is: suppose that $\phi:\mathbb{Z}[X] \to \mathbb{Q}$ is a ring homomorphism sending $X \to q/p$ in its lowest term. Show that $n/m \in \mathbb{Q}$ is in image of $\phi$ if every prime divisor of $m$ divides $p$.
I couldn't really think about any effective approach in an entire hour: what I can see from the info given is that $p^k$ will be a multiple of $m$ for sufficiently large $k$, but that doesn't seem to lead anywhere.
Also the problem didn't specify how the homomorphism deals with constant polynomials. But clearly, if the map just sent everything to $0$ then above theorem is false, which probably implies that the homomorphism is an identity on integers (?)
I might try to prove the contrapositive of the result, but then it doesn't seem to simplify the problem (if not make it worse).
I seem to fail at grasping one critical observation...
Any hints appreciated