I'm doing an exercise where I have a commutative ring with unity $R$. We had to find that the nonunits formed an ideal (maximal). After that, we found the irreducible elements, and then we saw that the set of irreducible elements was equal to the set of prime elements on $R$.
From here, the next section of the exercise is: Prove that $R$ is an UFD. Find the set of ideals of $R$.
I tried to find the easiest way to prove that $R$ is an UFD with the information we have so far, and it seems that it's proving that if $R$ is a domain and $a$ is irreducible $\iff$ $a$ is prime (because we already know that the set of primes and the irreducibles is the same, and it has only one element in my particular case).
But we didn't proved this proposition on my class, so I wonder if there's another way to prove that $R$ is an UFD without having to prove this lemma first.
Thank you.