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). 
 A: 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$.
A: 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.
