Let $R$ be a commutative ring with $1$ such that every proper ideal is a prime ideal. Prove that $R$ is a field. [Hint: for $a \neq 0$, consider the ideals $(a)$ and $(a^2)$].
Attempt.
Let $a \in R$ with $a \neq 0$. Now, $(a^2)$ is prime. Then $ra^2 \in (a^2)$ for $r \in R$. But I can write $ra^2 = ra \cdot a$. As $(a^2)$ is prime, then either $ra \in (a^2)$ or $a \in a^2$. Either way, $a \in (a^2)$ and so $(a) \subseteq (a^2)$. Trivially, we always have $(a^2) \subseteq (a)$. Thus, $(a)=(a^2)$.
Observe as well that since every ideal is prime, then $\langle 0 \rangle$ is prime. Thus, when $xy \in \langle 0 \rangle$ i.e. when $xy = 0$, then $x \in \langle 0 \rangle$ or $y \in \langle 0 \rangle$, i.e. $x=0$ or $y=0$. So $R$ is an integral domain.
Then as $(a) = (a^2)$, there is $r \in R$ so that $ra^2 = a$. As $R$ is an integral domain, we can cancel $a$ from both sides to get $ra=1$. And so $a$ is a unit, but then $R$ is a field.