  Integrated correlation functions in $\mathcal{N}=4$ supersymmetric
Yang--Mills theory with gauge group $SU(N)$ can be expressed in terms of the
localised $S^4$ partition function, $Z_N$, deformed by a mass $m$. Two such
cases are $\mathcal{C}_N=(\text{Im} \tau)^2 \partial_\tau\partial_{\bar\tau}
\partial_m^2\log Z_N\vert_{m=0}$ and $\mathcal{H}_N=\partial_m^4\log
Z_N\vert_{m=0}$, which are modular invariant functions of the complex coupling
$\tau$. While $\mathcal{C}_N$ was recently written in terms of a
two-dimensional lattice sum for any $N$ and $\tau$, $\mathcal{H}_N$ has only
been evaluated up to order $1/N^3$ in a large-$N$ expansion in terms of modular
invariant functions with no known lattice sum realisation. Here we develop
methods for evaluating $\mathcal{H}_N$ to any desired order in $1/N$ and finite
$\tau$. We use this new data to constrain higher loop corrections to the stress
tensor correlator, and give evidence for several intriguing relations between
$\mathcal{H}_N$ and $\mathcal{C}_N$ to all orders in $1/N$. We also give
evidence that the coefficients of the $1/N$ expansion of $\mathcal{H}_N$ can be
written as lattice sums to all orders. Lastly, these large $N$ and finite
$\tau$ results are used to accurately estimate the integrated correlators at
finite $N$ and finite $\tau$.
