2 added 99 characters in body

For any open subset $U\subseteq\mathrm{Spec}(A)$ let $S_U=A\setminus\bigcup_{\mathfrak p\in U}\mathfrak p$ and $\mathscr O'(U)=A[S_U^{-1}]$. It is obviously a presheaf.

Claim: For open subsets of the form $U=\mathrm{Spec}(A_f)$ with $f\in A$ we have $\mathscr O'(U)=A_f$. (This shows that the associated sheaf of $\mathscr O'$ is indeed $\mathscr O_{\mathrm{Spec}(A)}$.)

Proof: Assume there is an $s\in S_U$ which does not divide $f^n$ for any $n$. The ideal $(s)$ does not meet the multiplicative set $S_f=\{1,f,f^2,\dots\}$, so it is contained in an ideal $\mathfrak q$ which is maximal with respect to this property, but it is well-known that such an ideal $\mathfrak q$ is prime. By construction, $s\in\mathfrak q\in U$, contradicting $s\in S_U$.

Applying the usual associated sheaf construction to $\mathscr O'$ seems to be what Hartshorne does when he defines $\mathscr O_{\mathrm{Spec}(A)}$.

1

For any open subset $U\subseteq\mathrm{Spec}(A)$ let $S_U=A\setminus\bigcup_{\mathfrak p\in U}\mathfrak p$ and $\mathscr O'(U)=A[S_U^{-1}]$. It is obviously a presheaf.

Claim: For open subsets of the form $U=\mathrm{Spec}(A_f)$ with $f\in A$ we have $\mathscr O'(U)=A_f$.

Proof: Assume there is an $s\in S_U$ which does not divide $f^n$ for any $n$. The ideal $(s)$ does not meet the multiplicative set $S_f=\{1,f,f^2,\dots\}$, so it is contained in an ideal $\mathfrak q$ which is maximal with respect to this property, but it is well-known that such an ideal $\mathfrak q$ is prime. By construction, $s\in\mathfrak q\in U$, contradicting $s\in S_U$.

Applying the usual associated sheaf construction to $\mathscr O'$ seems to be what Hartshorne does when he defines $\mathscr O_{\mathrm{Spec}(A)}$.