Therefore to prove that $\mathbb{Z}[q]^\mathbb{N}$ is not a UFD, we should exhibit an element $f$ with two different factorizations, right?
There is another option. One can also exhibit an element having no prime factorisation. And prime factorisations are always unique if they exist, it's factorisations into irreducible elements that may be non-unique.
For an element $g$ having a prime factorisation, i.e. that can be written as the product of a unit and finitely many primes, the set of primes dividing $g$ is finite (modulo identification of associated primes). In every divisor, only the primes occurring in the factorisation of $g$ can occur, with at most the power of the prime occurring in $g$.
As was shown, the constructed $f$ is divisible by infinitely many primes, hence it doesn't have a prime factorisation.
We need to verify conditions 1 and 2 of the previous definition. When it comes to condition 1, we have no difficulties. In fact, we have that $c \mid a$ since:
\begin{equation}
a = u \cdot p_1^{d_1} \cdots p_s^{d_s} = (p_1^{f_1} \cdots p_s^{f_s}) \cdot (u \cdot p_1^{d_1-f_1} \cdots p_s^{d_s-f_s}) = c \cdot (u \cdot p_1^{d_1-f_1} \cdots p_s^{d_s-f_s})
\end{equation}
Similarly, we have that $c \mid b$, thus condition 1 is satisfied.
Now, given an element $d \in R$ such that $d \mid a$ and $d \mid b$, such element is nonzero by definition of divisibility. If $d \in U(R)$, then $d \mid c$ because $c = d \cdot (d^{-1} \cdot c)$. Assume $d \notin U(R)$. Then, by definition of UFD, there exist $w \in U(R)$, irreducible elements $q_1,\dots,q_r \in R$ which are mutually not associate, $g_1,\dots,g_r \in \mathbb{N}^*$ such that:
\begin{equation}
d = w \cdot q_1^{g_1} \cdots q_r^{g_r}
\end{equation}
We're now going to use this fact:
$d \mid a$ implies that every irreducible factor of $d$ is associated to an irreducible factor of $a$.
By relabeling (which is legitimate since $R$ is a commutative ring), we can assume that $q_i$ is associated to $p_i$ for all $1 \leq i \leq r$. In particular, since $p_1,\dots,p_r$ are mutually not associate, for all $1 \leq i \leq n$ we have that $q_i$ is only associated to $p_i$, thus $g_i \leq d_i$. Similarly, since $d \mid b$ we have that $g_i \leq e_i$ for all $1 \leq i \leq s$. Thus by definition of $f_1,\dots,f_s$ we also have that $g_i \leq f_i$ for all $1 \leq i \leq s$. Now, by definition of associate elements, we have that $q_i \mid p_i$ for all $1 \leq i \leq r$, hence $p_i = q_i \cdot x_i$ for some $x_i \in R$. Thus:
\begin{align*}
c & = (p_1^{f_1} \cdots p_r^{f_r}) \cdot (p_{r+1}^{f_{r+1}} \cdots p_s^{f_s}) \\ & = \bigl((q_1^{f_1} \cdot x_1^{f_1}) \cdots (q_r^{f_r} \cdot x_r^{f_r})\bigr) \cdot (p_{r+1}^{f_{r+1}} \cdots p_s^{f_s}) \\ & = d \cdot (q_1^{f_1-g_1} \cdots q_r^{f_r-g_r}) \cdot (x_1^{f_1} \cdots x_r^{f_r}) \cdot (p_{r+1}^{f_{r+1}} \cdots p_s^{f_s}) \cdot w^{-1}
\end{align*}
This proves that $d \mid c$ and so condition 2 is verified. Hence c is a GCD of $a$ and $b$ and we're done.
Edit: we are now going to prove the fact we used. More precisely, we are going to prove the following result.
Let $R$ be a unique factorization domain, let $a,b \in R$, $a,b \neq 0$, $a,b \notin U(R)$ and let $a = c_1 \cdots c_n$, $b = d_1 \cdots d_m$ factorizations of $a$ and $b$ in irreducible elements. If $b \mid a$, then $m \leq n$ and there exists a permutation $\sigma : \{1,\dots,n\} \to \{1,\dots,n\}$ such that $d_i$ is associated to $c_{\sigma(i)}$ for all $1 \leq i \leq m$.
Indeed, if $b \mid a$, then there exists $x \in R$ such that $a = b \cdot x$.
Assume $x \in U(R)$. In this case, by defining $d_m' : = d_m \cdot x$, we have two factorizations of $a$ in irreducible elements, that is $a = c_1 \cdots c_n$ and $a = d_1 \cdots d_{m-1} d_m'$. Since $R$ is a unique factorization domain, we must have $n = m$ and a permutation $\sigma : \{1,\dots,n\} \to \{1,\dots,n\}$ such that $d_i$ is associated to $c_{\sigma(i)}$ for all $1 \leq i \leq m - 1$ and $d_m'$ is associated to $c_{\sigma(m)}$. In addition, since we are assuming $x \in U(R)$, the element $d_m'$ is also associated to $d_m$ and therefore $d_m$ is associated to $c_{\sigma(m)}$ by simmetry and transitivity of the association relation.
Now assume $x \notin U(R)$. Since $a \neq 0$ by hypothesis, we have $x \neq 0$. Since $R$ is a unique factorization domain, there exists a factorization in irreducible elements $x = e_1 \cdots e_s$. But then we have two factorizations of $a$ in irreducible elements, that is $a = c_1 \cdots c_n$ and $a = d_1 \cdots d_m \cdot e_1 \cdots e_s$. Once again, by using the hypothesis that $R$ is a unique factorization domain, we get $n = m + s$ and a permutation $\sigma : \{1,\dots,n\} \to \{1,\dots,n\}$ such that $d_i$ is associated to $c_{\sigma(i)}$ for all $1 \leq i \leq m$ and $e_i$ is associated to $c_{\sigma(m + i)}$ for all $1 \leq i \leq s$. In particular, we have what we wanted to prove.
Best Answer
I am going to attempt to write a proof that is much shorter than my original proof. I would greatly appreciate some feedback! Thank you!
Let $c=p_1\cdots p_n$ where each $p_i$ is an irreducible in $R$. Since $R$ is a unique factorization domain, each $p_i$ is prime. Thus, since $c|ab \Rightarrow (p_1\cdots p_n) | ab \Rightarrow p_i|ab$, meaning $p_i|a$ or $p_i|b$. However, since $\gcd (a,c)=1 \Rightarrow \gcd (a,p_i)=1$, thus each $p_i$ must divide $b$, implying that $c|b$.