Let $R$ be a UFD. I'm trying to understand whether the following statements are equivalent:
1) $r\in R$ lies in some prime ideal $P$ but not in the ideal $P^2$.
2) $r$ is divisible by a prime element of $R$ but not by its square.
I think I can see why 2) implies 1). Suppose 2) holds, say $r$ is divisible by a prime element $p$ but not by $p^2$. Then $r$ lies in the ideal $P=(p)$, which is prime because $p$ is prime. Also $r$ does not lie in $P^2$, because otherwise it would be divisible by $p^2$. Is that right?
Suppose 1) holds. $P$ is an abstract prime ideal. Does it necessarily contain a prime element? If so, I would be able to conclude that $r$ is divisible by that prime element. (I think it must be finitely generated since $R$ is a UFD, do the generators have to be prime elements?) Does the condition $r\notin P^2$ imply that $r $ is not divisible by the square of that element?