Solution (source code)

= Solution

Extension and contraction give the <prime ideal correspondence for localization>
$$
\boxed{\operatorname{Spec}(S^{-1}R)
\longleftrightarrow
\{\mathfrak p\in\operatorname{Spec}R:\mathfrak p\cap S=\varnothing\}.}
$$
Explicitly, $\mathfrak p$ maps to $S^{-1}\mathfrak p$, while $\mathfrak q\subseteq S^{-1}R$ maps to $\{r:r/1\in\mathfrak q\}$. Primality follows by clearing denominators, and the two operations are inverse because an ideal in a localization contains $r/s$ exactly when it contains $r/1$.