It is very well known that if $\mathfrak p\_1, \ldots,\mathfrak p\_n$ are prime ideal of an integral domain $A$, then we have the equality$$S^{-1}A=\bigcap\_{i=1}^n A\_{\mathfrak{p}\_i},$$ where $S:=A\setminus\cup\_i\mathfrak p\_i$. 


For a proof of the above, see for example [this](https://math.stackexchange.com/questions/337826/intersection-of-two-localizations).


Now I'm asking myself if the equality above holds true for any family (infinite) of prime ideals. Any reference or counterexample would be appreciated.



Localization and intersection
This is not true. Morally, the right hand side corresponds to the functions that are regular at all $\mathfrak p\_i$, and one can show that this is not always a localisation of the entire ring $A$.


**Example.** Let $(E,O)$ be an elliptic curve over an algebraically closed field $k$, and let $P \in E(k)$ be a non-torsion point. Let $X = E \setminus \{O\}$, and $U = X \setminus\{P\}$. Then $X$ and $U$ are affine, and $U$ is not a principal affine open of $X$ (see e.g. [this post](https://mathoverflow.net/a/7185/82179)).


If $X = \operatorname{Spec} A$, then $P$ corresponds to a prime $\mathfrak p \subseteq A$. We consider the intersection
$$\bigcap\_{\mathfrak q \neq \mathfrak p} A\_\mathfrak q \subseteq \operatorname{Frac} A$$
and the set
$$S = A \setminus \bigcup\_{\mathfrak q \neq \mathfrak p} \mathfrak q.$$
(In either case, it doesn't matter whether we include the zero ideal as well or only the maximal ideals.)
We claim that $S = A^\times$. Indeed, clearly $A^\times \subseteq S$. Conversely, suppose $f \in A$ is not in $A^\times$. Then $V(f)$ contains a point $Q \neq P$, hence $f$ is contained in a prime $\mathfrak q \neq \mathfrak p$. Thus, $f \not \in S$.


This proves that $S = A^\times$, and therefore $S^{-1}A$ is just $A$. But if $B = \Gamma(U,\mathcal O\_U)$, then
$$\bigcap\_{\mathfrak q \neq \mathfrak p} A\_{\mathfrak q} = \bigcap\_{\mathfrak r \in \operatorname{Spec} B} B\_{\mathfrak r} = \Gamma(U,\mathcal O\_U),$$
which cannot be equal to $A$ because $X \not \cong U$. $\square$


