TITLE: Localness of the UFD Property
QUESTION [6 upvotes]: If $A$ is a noetherian domain and $A_p$ is a UFD for some prime ideal, is there some $f$ not contained in $p$ such that $A_f$ is a UFD?

REPLY [4 votes]: The answer is no in general.
Let $C$ be a smooth projective curve over some field $K$, of positive genus. Let $U$ be a non-empty affine open subset of $C$ and let $A=\mathcal O_C(U)$. Then $A$ is a Dedekind domain. In particular, the localization of $A$ at any prime ideal is a PID, hence UFD. Let $V\subseteq U$ be an open subset (e.g. defined as $D(f)$, with $\mathcal O_X(V)=A_f$) and let us see whether $\mathcal O_X(V)$ is UFD, or equivalently, PID, or again $\mathrm{Pic}(V)=\{ 1\}$ (the Picard group of $V$ is the same as the class ideal group of $\mathcal O_X(V)$). 
Let $p_1,\dots, p_n$ be the points in the complement of $V$ in $C$. Any divisor of degree $0$ on $C$ gives rise, by restriction, to a divisor on $V$. Moreover, this restriction is compatible with linear equivalence. So we have a canonical map 
$$ \mathrm{Pic}^0(C)\to \mathrm{Pic}(V).$$
Edit (thanks to Georges' comments) The elements of the kernel of this map are all linear combinations of the classes of $p_1, \dots, p_n$: if a divisor $D$ on $C$ is trivial on $V$, then $D\sim \sum_i a_ip_i$ with $a_i\in \mathbb Z$. Therefore we obtain an exact sequence
$$ 0\to H \to \mathrm{Pic}^0(C)\to \mathrm{Pic}(V)$$
with $H$ a finitely generated abelian group. end of edit.
If $\mathcal O_C(V)$ has trivial Picard group, then $\mathrm{ Pic}^0(C)$ is a finitely generated abelian group. But this is not always true. In fact, if $J$ is the Jacobian of $C$ (and suppose $C$ has a rational point in $K$), then $\mathrm{ Pic}^0(C)=J(K)$. If $K$ is algebraically closed and uncountable, then $J(K)$ is uncountable because $J$ is an algebraic variety of positive dimension (equal to the genus of $C$). 
Concrete example: let $C$ be an elliptic curve over $\mathbb C$ and take $U=C\setminus \{ 0\}$. Then for all $f\in A:=\mathcal O_C(U)$, $A_f$ is never a PID.