Is a localization of a UFD at a prime ideal a PID? I have this problem: 

Let $R$ be an UFD and $p$ a prime element. Prove $R_{(p)}$ is a PID. 

I think I'm just struggling to get started. I know that $R_{(p)}=\{\frac{a}{b}: a \in R, b \in R\setminus(p)\}$. I also know that any ideal in $R_{(p)}$ will be contained in the maximal ideal $(p)R_{(p)}$. Any ideas? 
 A: No, a PID is necessarily 1-dimensional - that means, that any strictly increasing sequence of prime ideals $P_1\subsetneq P_2\subsetneq P_3\cdots$ has length at most 2. Ie, if $p$ is a prime element in your PID, then the maximal sequence containing $(p)$ is $(0)\subsetneq (p)$.
On the other hand, UFD's are far more general. For the simplest counterexample, consider $k[x,y]$, and localize at any maximal prime, say $(x,y)$. Then in $k[x,y]_{(x,y)}$ it's pretty clear that $(x,y)k[x,y]_{(x,y)}$ is not principally generated, corresponding to the fact that you have a sequence of primes
$$(0)\subsetneq (x)\subsetneq (x,y)$$
EDIT: I just noticed that your actual question does not agree with your title.
If you pick a prime element, then yes the localization is a PID. This is because for any $f\in R$ with $f$ not divisible by $p$ (ie, $f\notin (p)$), $f$ becomes a unit in $R_{(p)}$. Also, since $R$ is a UFD, it's got no zero divisors, so the natural map $R\rightarrow R_{(p)}$ is an injection, from which we see that the only nonunits in $R_{(p)}$ are the elements of $R$ which lie in $(p)$. Now suppose you have an ideal $I := (r_1,r_2,\ldots)$. Let $p^n$ be the highest power of $p$ dividing them all (this makes sense because of unique factorization). We certainly have $I\subset (p^n)$. On the other hand, by definition one of the $r_i$'s must be of the form $up^n$, where $u$ is not divisible by $p$, so $u$ is a unit, so $u^{-1}up^n = p^n\in I$, so $(p^n)\subset I$.
A: It is well known that An integral domain whose every prime ideal is principal is a PID. A prime ideal of $R_{(p)}$ is of the form $\mathfrak pR_{(p)}$ where $\mathfrak p$ is a prime ideal of $R$ contained in $(p)$. I claim that $\mathfrak p=(p)$, unless $\mathfrak p=(0)$. Suppose that $p\notin\mathfrak p$ and let $a\in\mathfrak p$, $a\ne0$. Then $a=pa_1$. Since $a\in\mathfrak p$ and $p\notin\mathfrak p$ we have $a_1\in\mathfrak p$, so $a_1=pa_2$. By the same argument $a_2=pa_3$, and so on. Thus $p^n\mid a$
 for all $n\ge1$, a contradiction.
