$(f) = (c)(g)$, where $R$ is a UFD, $c \in R$, $f,g \in R[x]$, and $g$ is primitive Let $R$ be a ring, and let $I$ be an ideal of $R$. Then $IR[x] = \{a_0 + \cdots + a_dx^d \in R[x] \mid a_i \in I \}$ is an ideal of $R[x]$.
Let $R$ be a commutative ring, and let $f = a_0 + a_1x + \cdots + a_dx^d \in R[x]$ be a polynomial.
$f$ is a primitive if for all prime ideals $\rho$ of $R$, $f \notin \rho R[x]$.

Let $R$ be a UFD. The content of a nonzero polynomial $f \in R[x]$, denoted $\operatorname{cont}_f$, is the $\gcd$ of its coefficients. As any $\gcd$ in an integral domain, it's defined only up to associate relation.
We also know that if $R$ is a UFD, then $f$ is primitive if and only if $(\operatorname{cont}_f) = (1)$.

Now, what I need to prove is that:

Let $R$ be a UFD, and let $f \in R[x]$. Then if $(f) = (c)(g)$ (where $(c)(g) = (cg)$), with $c \in R$, and $g$ primitive, then $(c) = (\operatorname{cont}_f)$.

I tried some things, but I to no avail (like reducing ideals the equality to $f = ucg$ for a unit $u$ in $R$ and then seeing what can we extract from the equality $a_i = ucb_i$). Right now I don't have any ideas on approaching a proof.
Suppose $(f)=(c)(g)$. Then $(f)=(cg)$. So, $f =ucg$ for some unit $u \in R$.

What is the $\gcd$ of the coefficients of $f$?

It is the $\gcd$ of the coefficients of $ucg$. Since $g$ is primitive, the $\gcd$ of the coefficients of $ucg$ is $uc$. Thus, the $\gcd$ of the coefficients of $f$ is $uc$.

But since $\gcd$ is defined up to units, then we can say the $\gcd$ of the coefficients of $f$ is just $c$.

So, $(\mathrm{cont}_f) =(c)$.
$\newcommand{\cont}{\operatorname{cont}}$Hint:$f=\cont_f{f\over {\cont_f}}$ and ${f\over {\cont_f}}$ is a primitive polynomial, $f=cg=\cont_f{f\over {\cont_f}}$ where $g$ is a primitive polynomial implies that $c|\cont_f$ and $\cont_f|c$.