This is probably too long for a comment, but it ties in with the answers already given. In dimension 2, factorial local rings are very rare.
In dimension 2, factorial local rings are very rare. There is a fascinating discussion, with references, in Hartshorne, V.5.8. In particular, over an algebraically closed field $k$ of characteristic not equal to 2,3,5, the ring $k[[x,y,z]]/(x^2+y^3+z^5)$ is the only 2-dimensional factorial non-regular normal complete local ring. (I remember being spellbound by the statement when I read Harstshorne for the first time and memorizing it as a perfect example of impressive and impenetrable mathspeak). This ring is the completed coordinate ring of the Klein – du Val singularity $\mathbb{A}^2/\Gamma$ of type $E_8$, where $\Gamma$ is the binary icosahedral group. Among the $A, D, E$ root systems, $E_8$ is the only type for which the determinant of the Cartan matrix is 1 (equivalently, the weight and root lattices coincide). For all other Kleinian singularities, you can see very explicitly that the unique factorization fails (see Shafarevich, IV.4.3 of 2nd edition or Springer, Invariant Theory):
$A_n: x^2+y^2+z^{n+1}=0$$A_n: x^2+y^2+z^{n+1}=0, \quad (x+iy)(x-iy)=-z^{n+1}$
$D_n: x^2+yz^2+z^{n-1}=0, \;n\geq 4$$D_n: x^2+yz^2+z^{n-1}=0, \;n\geq 4 \quad x^2=-z^2(y+z^{n-3})$
$E_6: x^2+y^3+z^4=0$$E_6: x^2+y^3+z^4=0 \quad (x+iz^2)(z-iz^2)=-y^3$
$E_7: x^2+y^3+yz^3=0$$E_7: x^2+y^3+yz^3=0 \quad x^2=-y(y^2+z^3)$
$E_8: x^2+y^3+z^5=0$$E_8: x^2+y^3+z^5=0 \quad$ factorial
(See Shafarevich As has already been mentioned, IV.4.3 of 2nd edition or Springerall these rings are normal domains with trivial Picard group, Invariant Theory.)since they are the $\Gamma$-invariant subrings for a finite group $\Gamma.$