Can Fermat's Two Squares Theorem be phrased in terms of Schemes?
Fermat's two squares theorem says that a prime number $p = a^2 + b^2$ is the sum of two squares if and only if $p = 4k+1$. How might I phrase this in terms of Schemes?
I know that $\mathrm{Spec}(\mathbb{Z}) = \{ primes \}$. And maybe we are saying there is a map or fibration from $X = \{ a^2 + b^2\}$ to $\mathrm{Spec}(\mathbb{Z})$ ?
Schemes may seem like overkill, but it is one of the very first exercises in, say David Eisenbud and Joe Harris's The Geometry of Schemes to phrase modular arithmetic in terms of affine scheme theory:
It therefore makes sense to go beyond the first page of the number theory textbook and ask if Fermat's theorem can also be discussed in terms of Scheme theory (maybe unifying the considerations over $\mathbb{C}$ and $\mathbb{F}_p$).
We have that $$p=x^2+y^2$$defines a conic over $\mathbb{Q}$ and its rational points are solutions to this equation in $\mathbb{Q}$. Here we always add the points at infinity to make it a projective curve. But the same equation defines a conic bundle scheme over $\mathbb{Z}$ whose generic fiber is that conic over $\mathbb{Q}$ and that is proper over $\mathbb{Z}$ when a line at infinity is added—a $2$-dimensional scheme. The condition that it has an integral solution when $$p=4k+1$$is equivalent to saying that the conic over $\mathbb{Q}$ has a rational point whose closure in the scheme does not intersect the line at infinity.