What is the high-concept explanation on why real numbers are useful in number theory?

The Gödel Speedup Theorem provides some explanation why real numbers (and variants) are useful in proving statements in number theory.

Real numbers, complex numbers, and $p$-adic numbers are second-order objects over the natural numbers. Thus a proof of a number theoretic fact using such analytical devices is formally a proof of that fact in second-order arithmetic. The Gödel Speedup Theorem shows that there is a definite advantage to using second-order arithmetic to prove elementary number theoretic facts.

Gödel Speedup Theorem. Let $h$ be any computable function. There is an infinite family $\mathcal{H}$ of first-order (indeed $\Pi^0_2$) statements such that if $\phi \in \mathcal{H}$, then $\phi$ is provable in first-order arithmetic and if $k$ is the length of the shortest proof of $\phi$ in second-order arithmetic, then the shortest proof of $\phi$ in first-order arithmetic has length at least $h(k)$.

Since computable functions can grow very fast, this shows that there are true number theoretic facts that one can prove using second-order methods (e.g. complex analysis, $p$-adic numbers, etc.) but any first-order (a.k.a. elementary) proof is unfathomably long. Admittedly, the statements produced by Gödel to verify the theorem are very unnatural from a number theoretic point of view. However, it is a general fact that second-order proofs can be much much shorter and easier to understand than first-order proofs.


Addendum. This excellent post by Emil Jeřábek demonstrates another speedup theorem, which is in many ways more striking. The method of going from a first-order $T$ to a second-order $T^+$ is conservative, meaning that $T^+$ cannot prove more first-order theorems than $T$. However, the mere act of allowing sets to replace formulas and introducing the possibility of quantifying over such sets introduces speedups faster than any exponential tower. Introducing $\mathbb{R}$, $\mathbb{C}$, $\mathbb{Q}_p$ and so forth has a similar effect where one can package complicated ideas into conceptually simpler ones (e.g. replacing $\forall\exists$ statements by the higher-level idea of continuity) can lead to monumentally shorter proofs!


A possible explanation is that $\mathbb R$ is one of the completions of $\mathbb Q$. And why does this matter? A reason is the Hasse, or local-to-global, principle. A minimal example of this is the Hasse--Minkowski theorem, which states that if $$Q(x_1,\ldots,x_n) = \sum_{i,j=1}^n a_{ij} x_ix_j$$ is a quadratic form with $a_{ij} \in \mathbb Z$ and $\det (a_{ij}) \neq 0$, then the equation $$Q(x_1,\ldots,x_n)=0$$ has a nontrivial solution in the integers if and only if it has a solution in the reals and all the $p$-adics.


Consider the following

Theorem. The number of integral solutions of $x^2+y^2+z^2=4n+1$ tends to infinity as $n\to\infty$.

The only proofs (known to me) use a good deal of complex analyis. I will think of further examples as time permits.