Can a non-local ring have only two prime ideals?

The only way this would be possible is if the ring $R$ had two distinct maximal ideals $\mathfrak{m}$ and $\mathfrak{n}$, and no other prime ideals. I suspect that such a ring exists, though I don't know how to construct it.


If $(A,\mathfrak p)$ and $(B,\mathfrak q)$ are local rings with only one prime ideal, then $R=A\times B$ has this property: a prime ideal must contain either $(1,0)$ or $(0,1)$ since their product is $0$, and then it is easy to see the prime must be either $A\times\mathfrak q$ or $\mathfrak p\times B$, respectively. (More generally, if $R=A\times B$ for any two rings $A$ and $B$, the primes in $R$ are exactly the sets of the form $A\times \mathfrak q$ or $\mathfrak p\times B$ where $\mathfrak q$ is a prime of $B$ or $\mathfrak p$ is a prime of $A$.)

Conversely, every example has this form. Indeed, if $R$ is not local and has exactly two prime ideals, both prime ideals must be maximal. It follows that $\operatorname{Spec}(R)$ is a discrete space with two points $\mathfrak p$ and $\mathfrak q$. From the fact that the structure sheaf on $\operatorname{Spec}(R)$ is a sheaf it follows that the canonical map $R\to R_{\mathfrak p}\times R_{\mathfrak q}$ is an isomorphism (since $R_{\mathfrak p}$ is exactly the value of the structure sheaf on the open set $\{\mathfrak p\}$ and $R_{\mathfrak q}$ is exactly the value of the structure sheaf on the open set $\{\mathfrak q\}$).


Take $\dfrac{\mathbb{Z}}{6\mathbb{Z}}.$ There are 2 maximal ideals here $\frac{(2)}{(6)}$ and $\frac{(3)}{(6)}$, and these are the only ones.


Let $p$ and $q$ be two different prime ideals of $R$ of height zero. Set $S=R-(p\cup q)$ and consider $S^{-1} R.$ Maximal ideals are $S^{-1}p$ and $S^{-1}q $.

Note that there is a one-to-one correspondence between prime ideals of $S^{-1}R$ and prime ideals of $R$ which dont meet $S$ (3.11 of Atiyah-Macdonald).


Given two fields, $k_1,k_2$, the ring $k_1\times k_2$ has this property, with $\mathfrak m =k_1\times \{0\}$ and $\mathfrak n=\{0\}\times k_2$.

More generally, if $R_1$ and $R_2$ are local rings with no other prime ideals, then $R_1\times R_2$ has this property, I believe.

The real question is if you can find interesting cases of others. Specifically, is there an example $R$ which does not have any non-trivial idempotents - elements $e$ other than $1,0$ such that $e^2=e$.