TITLE: Localizations as free, finite rank modules
QUESTION [6 upvotes]: Let $K$ be a algebraic number field of degree $n$ over $\mathbb{Q}$, and $O$ its ring of integers. Let $P$ be a prime ideal of $O$ and $(p)=P \cap \mathbb{Z}$.
Is it true that the localization $O_{P}$ is a rank $n$ free module over $\mathbb{Z}_{(p)}$ (the localization of $\mathbb{Z}$ at $(p)$) if and only if $P$ is the only prime above $(p)$?

REPLY [6 votes]: Well, if $P$ is not the only prime above $p$, then $O_P$ cannot be a finitely-generated $\mathbb{Z}_{(p)}$-module for the following reason. Suppose $Q$ is another prime ideal above $p$ and select $\beta\in Q\setminus P$. Then $\beta^{-1}\in O_P$. If $O_P$ were finitely-generated as a module over $\mathbb{Z}_{(p)}$, then it would be integral over $\mathbb{Z}_{(p)}$, and hence would be contained in the integral closure of $\mathbb{Z}_{(p)}$ in $K$, which is $O_p$. But then $\beta^{-1}\in O_p$, so $1/\beta=\alpha/m$ for some integer $m$ not divisible by $p$. This means that $m=\alpha\beta\in Q$, whence $m\in Q\cap\mathbb{Z}=(p)$, a contradiction.