Irreducible but not prime element

Let $\rm\ R = \mathbb Q + x\:\mathbb R[x],\ $ i.e. the ring of real polynomials having rational constant coefficient. Then $\,x\,$ is irreducible but not prime, since $\,x\mid (\sqrt 2 x)^2\,$ but $\,x\nmid \sqrt 2 x,\,$ by $\sqrt 2\not\in \Bbb Q$


This is impossible: any polynomial ring over a field is a U.F.D. In such domains, irreducible elements are prime.

The simplest example is the ring of quadratic integers $\;\mathbf Z[i\sqrt 5]$, which is not a U.F.D.. In this ring, we have $$2 \cdot 3=(1+i\sqrt 5)(1-i\sqrt 5),$$ so that $2$ divides the product $\;(1+i\sqrt 5)(1-i\sqrt 5)$, but doesn't divide any of the factors, since it would imply the norm $N(2)=4$ divides $N(1\pm i\sqrt 5)=6$. $2\;$ is irreducible for similar reasons: if $ a+ib\sqrt 5$ is a strict divisor of $2$ and a non-unit, its norm $a^2+5b^2$ is a non-trivial divisor of $4$, i.e. $\;a^2+5b^2=2$. Unfortunately, this diophantine equation has no solution.

Thus, $2$ is a non-prime irreducible element. The same is true for all elements in these factorisations of $6$.

Another example, with polynomial rings:

Consider the ring of polynomial functions on the cusp cubic $$R=\mathbf C[X,Y]/(X^2-Y^3).$$ This is an integral domain, as the curve is irreducible. Actually, we have a homomorphism: \begin{align*} \mathbf C[X,Y]&\longrightarrow\mathbf C[T^2,T^3]\\ X&\longmapsto T^3,\\ Y&\longmapsto T^2. \end{align*} This homomorphism is surjective, and its kernel is the ideal $(X^2-Y^3)$, so that it induces an isomorphism $R\simeq \mathbf C[T^2,T^3]$.

If we denote $x$ and $y$ the congruence classes of $X$ and $Y$ respectively, we have $x^2=y^3$. The element $y$ is irreducible, for degree reasons, but it is not prime, since it divides $x^2$ but doesn't divide $x$.