Suppose every irreducible element in a domain $D$ is prime.
I'm trying to prove this implication:
In a integral domain $D$, if $a=c_1c_2...c_n$ and $a=d_1d_2...d_m$ ($c_i,d_i$ irreducible), then $n=m$ and up to order $c_i$ and $d_i$ are associates for every $i$.
My Solution
For each $i$, $c_i$ divides $d_1...d_m$, since $c_i$ is irreducible, hence prime, $c_i$ has to divide some $d_j$, $j\le m$, but $c_i$ and $d_i$ are irreducible, so $c_i$ and $d_j$ are associate.
Is my solution is correct so far?
how can I prove $n=m$?
Thanks in advance