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)$?

Well, if $P$ is not the only prime above $p$, then $O_P$ cannot be a finitelygenerated $\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 finitelygenerated 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. 


Dear Pedro, actually the localization $O_p$ is always free of rank $n$ over $\mathbb Z_{(p)}$, independently of the number of primes above $p$.The reason is that a) $O_p$ is of finite type and torsionless over $\mathbb Z_{(p)}$ b) $\mathbb Z_{(p)}$ is a principal ideal domain (PID for those in a hurry) A reference for these facts is the elegant little book by Samuel, Algebraic Theory of Numbers, inspired by a draft for Bourbaki, but written in a much more, hum how shall I say, friendly style. Edit Although what I wrote is (I hope) correct, it doesn't answer Pedro's question: he asked about $O_P$ and I answered about $ O_p$, as Keenan very politely commented. My sincerest apologies to Pedro and MathOverflow. However, as my friend Manuel Ojanguren remarked in order to to comfort me, if there is only one prime over $p$, then $O_p$ coincides with $O_P$ and we get that $O_P$ is finitely generated over $\mathbb Z_p$, which is one implication in the equivalence conjectured by Pedro. 

