Let $R$ be an integral domain. We say that an element $r\in R$ is a unit if it is invertible. A non-unit is called irreducible if it can not be represented as a product of two non-units.

A commutative integral domain $R$ is a unique factorization domain (UFD for short) if every non-unit has a factorization $u = r_1 \cdots r_n$ as product of irreducible non-units and this decomposition is unique up to renumbering and rescaling the irreducibles by units.

Put differently: $R$ is a UFD precisely when the multiplicative monoid of nonzero principal ideals of $R$ (which is isomorphic to the monoid $(R \setminus \{0\})/R^\times$, where $R^\times$ denotes the group of units) is a commutative monoidfreely generated by irreducible principal ideals. It follows that if $K$ is the field of fractions of $R$, then the quotient group$K^\times/R^\times$ is an abelian group that is freely generated by the set of cosets $f R^\times$ with $f$ ranging over irreducible elements. As a side remark, we observe that in this circumstance the exact sequence

If $R$ is a UFD and all of its localizations at primes are regular local rings, then the ring of formal power series$R[ [x] ]$ is a UFD.

For $D$ a positive integer, the ring of integers in $\mathbb{Q}(\sqrt{-D})$ is a UFD iff $D$ is a Heegner number, namely one of the numbers $1, 2, 3, 7, 11, 19, 43, 67, 163$.