Semilocal ring with n maximal ideals?

How do I build a semilocal ring, given the number of maximal ideals that ring should have ?

For example, for $n=25$ ($n$ is not necessarily prime).

• Yet another way to do it is to take $n$ distinct maximal ideals and localize at the intersection of their complements. The original $n$ maximal ideals should be the only ones left in the localization. – rschwieb May 25 '18 at 18:01
• – Watson May 25 '18 at 21:26
• Thank you for the related reference! – Ruxandra Mihaela Ichim May 27 '18 at 9:51

Given a positive integer $n$, let $m$ be any positive integer with exactly $n$ distinct prime factors, say $p_1,...,p_n$

Then the maximal ideals of the ring $R=\mathbb{Z}/m\mathbb{Z}$ are the principal ideals $(p_1),...,(p_n)$, so $R$ has exactly $n$ maximal ideals.

Here's another way . . .

Given a positive integer $n$, let $R$ be any commutative ring, with $1\ne 0$, such that $R$ has at least $n$ maximal ideals. For example, you could take $R=\mathbb{Z}$.

Let $M_1,...,M_n$ be distinct maximal ideals of $R$, and let $S$ be the complement of the union of $M_1,...,M_n$, i.e., $S=\{x\in R\mid x\notin {\small{{\displaystyle{\bigcup_{k=1}^n M_k\}}}}}$.

Then the ring $R_{S}$ has exactly $n$ maximal ideals, namely, $(M_1)_S,...,(M_n)_S$.

• Thanks, quasi! Really helpful answer! :* – Ruxandra Mihaela Ichim May 27 '18 at 9:47

As an alternative to quasi's answer, you can always choose any field $k$ and then set $R:=k^n$. Then you will have precisely $n$ distinct maximal ideals, namely the kernels of the projections $\pi_i: R\to k$ for $i=1,\dots,n$.

Edit: By the Chinese Remainder Theorem, my answer is not really different from quasi's after all.

• But I like it!${}{}{}$ – quasi May 25 '18 at 12:42