Solution (source code)

= Solution

Suppose $f$ is prime in $F[X]$ and divides $gh$ in $R[X]$. It divides one factor in $F[X]$, say $g=fq$ for $q\in F[X]$. Write $q=a q_0$ with $q_0\in R[X]$ primitive and $a\in F$. The product $fq_0$ is primitive. Since
$$
g=a(fq_0)
$$
has all coefficients in $R$, a denominator of $a$ would divide every coefficient of the primitive <polynomial> $fq_0$; it must therefore be a unit. Thus $a\in R$, so $q\in R[X]$ and $f$ divides $g$ in $R[X]$. Hence $f$ is prime in $R[X]$.