Improper Integrals as Riemann Sums and a Beautiful Limit $\lim_{n \to \infty}\frac{\sqrt[n]{n!}}{n}$ For some context, I recently encountered a beautiful limit.
$$\lim_{n \to \infty}\frac{\sqrt[n]{n!}}{n}$$
To solve this we begin by taking the natural log of the inside.
$$\ln\left(\frac{\sqrt[n]{n!}}{n}\right)=\ln\left(\frac{n!}{n^n}\right)^\frac{1}{n}=\frac{1}{n}\ln\left(\frac{n!}{n^n}\right)$$
Writing out the terms inside the $\ln$ makes it clear that we can express it as a sum.
$$\ln\left(\frac{n!}{n^n}\right)=\ln\left(\frac{1\cdot2 \dotsm n}{n\cdot n \dotsm n}\right)=\ln\left(\frac{1}{n}\right)+\ln\left(\frac{2}{n}\right)+\dotsm+\ln\left(\frac{n}{n}\right)=\sum_{i=1}^n\ln\left(\frac{i}{n}\right)$$
So what we are looking for is the following.
$$\lim_{n \to \infty}\frac{1}{n}\sum_{i=1}^n\ln\left(\frac{i}{n}\right)$$
Notice that this is the Riemann Sum from $0$ to $1$ of $\ln(x)$ so we have,
$$\lim_{n \to \infty}\frac{1}{n}\sum_{i=1}^n\ln\left(\frac{i}{n}\right)=\int_{0}^{1}\ln(x)dx$$
The integral can be solved using integration by parts which I will not include here but it evaluates to $-1$.
$$\int_{0}^{1}\ln(x)dx=-1$$
But as we took the natural log of the expression, we must undo it by putting it to the power of $e$.
$$\therefore\lim_{n \to \infty}\frac{\sqrt[n]{n!}}{n}=\frac{1}{e}$$
I was wondering if I could use the same kind of steps to make an expression equal to $e^\pi$. I realized I needed an integral based on $\ln(x)$ which evaluates to $\pi$ and found the following.
$$\int_{0}^{\infty}\ln\left(1+\frac{1}{x^2}\right)dx=\pi$$
However, the problem here is that this is an improper integral and the upper bound is at $\infty$. I've been looking for ways to express this as a Riemann Sum but intuitively it does not make sense to me. The point of Riemann Sums was to keep adding infinitely thin boxes infinite times, so is there any room to expand that so that the upper bound is at infinity?
Also, if you find any other integrals which can be used to make a nice expression like the one above, please include that too. I would love to solve it.
ps. This is my first post and also my first time using latex to write these equations. Any advice or suggestion is welcome. Thank you.
 A: Not an answer
If the problem is the bound of integration, you can make a substitution.
$$\int_{0}^{\infty}\ln\left(1+\frac{1}{x^2}\right)dx=\int_{0}^{1}\ln\left(1+\frac{1}{x^2}\right)dx+\int_{1}^{\infty}\ln\left(1+\frac{1}{x^2}\right)dx$$
In the second integral, let $1/x=t$:
$$\int_{1}^{\infty}\ln\left(1+\frac{1}{x^2}\right)dx=\int_{0}^{1}\frac{1}{t ^2}\ln\left(1+t^2\right)dt $$
I don't know if written this way it's more managable to find the Riemann sum.
A: We have
\begin{align*}
\int_{0}^{\infty} \log \left( 1 + \frac{1}{x^2} \right) \, \mathrm{d}x
&= \lim_{n\to\infty} \sum_{k=1}^{\infty} \log \left( 1 + \frac{n^2}{k^2} \right) \frac{1}{n} \\
&= \lim_{n\to\infty} \frac{1}{n} \log \left[ \prod_{k=1}^{\infty} \left( 1 + \frac{n^2}{k^2} \right) \right] \\
&= \lim_{n\to\infty} \frac{1}{n} \log \left( \frac{\sinh(n\pi)}{n\pi} \right).
\end{align*}
So, the equality $\int_{0}^{\infty} \log \left( 1 + \frac{1}{x^2} \right) \, \mathrm{d}x = \pi$ is equivalent to
$$ \lim_{n\to\infty} \left( \frac{\sinh(n\pi)}{n\pi} \right)^{\frac{1}{n}} = e^{\pi}, $$
which is in fact much easier to prove only using calculus.
A: Not an answer
I believe I've made some progress. First, I used the substitution by @Sine of the Time, $t=\frac{1}{x}$ to change the bounds of integration and ended up with the following.
$$\int_{0}^{\infty}\ln\left(1+\frac{1}{x^2}\right)dx=\int_{0}^{1}\ln\left(1+\frac{1}{x^2}\right)dx+\int_{0}^{1}\frac{1}{t ^2}\ln\left(1+t^2\right)dt$$
Then, I looked back at the transformation from the initial problem,
$$\lim_{n \to \infty}\frac{1}{n}\sum_{i=1}^n\ln\left(\frac{i}{n}\right)=\int_{0}^{1}\ln(x)dx$$
and transformed both integrals similarly.
$$\int_{0}^{1}\ln\left(1+\frac{1}{x^2}\right)dx=\lim_{n \to \infty}\frac{1}{n}\sum_{i=1}^n\ln\left(1+\frac{1}{\left(\frac{i}{n}\right)^2}\right)=\lim_{n \to \infty}\frac{1}{n}\sum_{i=1}^n\ln\left(1+\frac{n^2}{i^2}\right)$$
$$\int_{0}^{1}\frac{1}{t ^2}\ln\left(1+t^2\right)dt=\lim_{n \to \infty}\frac{1}{n}\sum_{i=1}^n
\frac{1}{\left(\frac{i}{n}\right)^2}
\ln\left(1+\left(\frac{i}{n}\right)^2\right)=\lim_{n \to \infty}\frac{1}{n}\sum_{i=1}^n
\frac{n^2}{i^2}
\ln\left(1+\frac{i^2}{n^2}\right)
$$
So what we are looking for is this.
$$\int_{0}^{1}\ln\left(1+\frac{1}{x^2}\right)dx+\int_{0}^{1}\frac{1}{t ^2}\ln\left(1+t^2\right)dt=\lim_{n \to \infty}\frac{1}{n}\left(\sum_{i=1}^n\ln\left(1+\frac{n^2}{i^2}\right)+\sum_{i=1}^n
\frac{n^2}{i^2}
\ln\left(1+\frac{i^2}{n^2}\right)\right)$$
Combining the two summations leaves us with this.
$$ \lim_{n \to \infty}\frac{1}{n}\sum_{i=1}^n\ln\left(\left(1+\frac{n^2}{i^2}\right)\left(1+\frac{i^2}{n^2}\right)^\frac{n^2}{i^2}\right)$$
However, now I am stuck as I can't figure out a clever way to continue simplifying the expression. The second term $\left(1+\frac{i^2}{n^2}\right)^\frac{n^2}{i^2}$ looks somewhat similar to $\lim_{n \to \infty}\left(1+\frac{1}{x}\right)^x=e$, but this too I can't figure out how to apply. My next step is to expand each sum individually instead of combining them like I did, and maybe some things might cancel out. Do you guys have any ideas on how to further simplify the summation?
