Curious relation between $e$ and $\pi$ that produces almost integers

This comes from the identity

$$ \sum_{m=-\infty}^\infty e^{-\pi m^2 x} = x^{-1/2} \sum_{n=-\infty}^\infty e^{-\pi n^2/x} $$

Take $x = 1/9$, and note that $\exp(-9 \pi n^2)$ is very small except for $n=0$, while $\exp(-\pi n^2/9)$ is small for $|n| > 8$.


Using the identity provided by Robert Israel (which can be derived using the Poisson summation formula), we have $$\sum_{k = -\infty}^{\infty}e^{-k^2\tfrac{\pi}{n}} = \sum_{k = -\infty}^{\infty}\sqrt{n}e^{-n\pi k^2}.$$

We can bound the second summation by: $$\sqrt{n} \le \displaystyle\sum_{k = -\infty}^{\infty}\sqrt{n}e^{-n\pi k^2} = \sqrt{n}+2\sqrt{n}\displaystyle\sum_{k = 1}^{\infty}e^{-n\pi k^2} \le \sqrt{n}+2\sqrt{n}\displaystyle\sum_{k = 1}^{\infty}e^{-n\pi k} = \sqrt{n} + \dfrac{2\sqrt{n}}{e^{n\pi}-1}.$$

Also, we can bound the tails of the first summation by:

$$2e^{-n\pi} \le \displaystyle\sum_{|k| \ge n}e^{-k^2\tfrac{\pi}{n}} = 2\displaystyle\sum_{k = n}^{\infty}e^{-k^2 \tfrac{\pi}{n}} \le 2\displaystyle\sum_{k = n}^{\infty}e^{-nk \tfrac{\pi}{n}} = \dfrac{2e^{-n\pi}}{1-e^{-\pi}}.$$

Hence, $$\displaystyle\sum_{k = -(n-1)}^{n-1}e^{-k^2\tfrac{\pi}{n}} = \sum_{k = -\infty}^{\infty}\sqrt{n}e^{-n\pi k^2} - \displaystyle\sum_{|k| \ge n}e^{-k^2\tfrac{\pi}{n}}$$ can be bounded by $$\sqrt{n}-\dfrac{2e^{-n\pi}}{1-e^{-\pi}} \le \displaystyle\sum_{k = -(n-1)}^{n-1}e^{-k^2\tfrac{\pi}{n}} \le \sqrt{n} + \dfrac{2\sqrt{n}}{e^{n\pi}-1}-2e^{-n\pi}.$$

To bound $\displaystyle\sum_{k = 1}^{n-1}e^{-k^2\tfrac{\pi}{n}}$, simply subtract $1$ (for the $k = 0$ term) and divide by $2$ (since the $-k$-th term and the $k$-th term are equal) to get

$$\dfrac{\sqrt{n}-1}{2}-\dfrac{e^{-n\pi}}{1-e^{-\pi}} \le \displaystyle\sum_{k = 1}^{n-1}e^{-k^2\tfrac{\pi}{n}} \le \dfrac{\sqrt{n}-1}{2} + \dfrac{\sqrt{n}}{e^{n\pi}-1}-e^{-n\pi}.$$

Thus, the error in approximating $\dfrac{\sqrt{n}-1}{2}$ is at most $\max\left\{\dfrac{e^{-n\pi}}{1-e^{-\pi}},\dfrac{\sqrt{n}}{e^{n\pi}-1}-e^{-n\pi}\right\}$. For $n = 9$, this is roughly $1.051\times 10^{-12}$.