Localizations as free, finite rank modules

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

-
Yes it's true, Pedro. Since I'm responsible for some confusion, due to my original misreading of the question, allow me to sum up. a) If there are at least two primes over p, then $O_P$ is not finitely generated over $\mathbb Z_{(p)}$ : this is Keenan's answer. b) If there is only on prime over p, then $O_P$ is finitely generated over $\mathbb Z_{(p)}$. This is in the edited part of my answer (and also follows from Keith's comments, if I am not mistaken ). – Georges Elencwajg Jul 10 '10 at 10:26

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.

-
I can't get the LaTeX to render correctly. – Keenan Kidwell Jul 9 '10 at 12:51
Thank you, Georges and Keenan, for your answers. My question was exactly as Keenan put it and I was getting to the same conclusion. But if $pO=P^{d}$ then everything is allright, right? – Pedro Martins Rodrigues Jul 9 '10 at 12:52
@Keenan: Re LaTeX. Read the box entitled "how to write math" down there on the right hand side. You need to use more backticks. – Kevin Buzzard Jul 9 '10 at 14:36
Thank you Kevin. My obliviousness knows no bounds. – Keenan Kidwell Jul 9 '10 at 14:39
No need to introduce $\beta$. Let $P$ and $Q$ be primes lying over $p$ in $O_K$. If $O_P$ is integral over ${\mathbf Z}_{(p)}$ then it's inside $O_p$ and hence inside $O_Q$. Both $O_P$ and $O_Q$ are maximal subrings of $K$, so containment implies equality and then intersecting $O_P$ and $O_Q$ with $O_K$ shows $P = Q$. – KConrad Jul 9 '10 at 19:55

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.

-
I wish my friends spoke like Bourbaki. It sure would save a lot of time =D! – Harry Gindi Jul 9 '10 at 10:52
Excellent, Harry: +1 – Georges Elencwajg Jul 9 '10 at 10:59
I think the poster was asking about $O_P$, where $P$ is a prime ideal of $O$ above $p$, in which case the answer is different. – Keenan Kidwell Jul 9 '10 at 12:44
Thank you, Keenan, you are absolutely right.I have just edited my post accordingly. – Georges Elencwajg Jul 9 '10 at 14:57