Solution (source code)

= Solution

Write the rational root in lowest terms as $a/b$. The factor $bx-a$ is primitive and divides $f$ over $\mathbb Q[x]$; Gauss's lemma makes it divide in $\mathbb Z[x]$. Comparison of leading coefficients makes $b$ divide the leading coefficient one, so $b=\pm1$ and the root is <integral>.