<s>[INST] How to find $\lim_{n\to\infty}\Big(\sum_{k=1}^n\sqrt{\frac{1}{k}-\frac{1}{n}}-\frac{\pi}{2}\sqrt n\Big)$? I'm looking for the asymptotic of the series $\displaystyle S(n)=\frac{1}{2}\sum_{k=1}^n\int_k^n\frac{dx}{x\sqrt{x(n-x)}}\,$ at $\,n\to\infty$
The first term can be found, for example, via switching to Riemann sums, changing the order of integration, and is equal to $\frac{\pi}{2}$. To find the next term I performed integration and got
$$S(n)=\frac{1}{n}\sum_{k=1}^{n-1}\sqrt{\frac{n}{k}-1}=\frac{1}{\sqrt n}\sum_{k=1}^{n-1}\sqrt{\frac{1}{k}-\frac{1}{n}}=\frac{1}{\sqrt n}\sum_{k=1}^{n-1}f(k)\tag{1}$$
To get the flavour of the next asymptotic term I used the Euler-Maclaurin formula
$$\sum_{k=1}^{n-1}f(k)\sim\int_1^{n-1}f(k)dk+\frac{1}{2}\big(f(1)+f(n-1)\big)+\frac{1}{12}\big(f'(n-1)-f'(1)\big)+ ...\tag{2}$$
At $n\to\infty$ the first term (the integral) gives $\frac{\pi}{2}\sqrt n-2$; other terms in (2) give non-zero values at $k=1$. Evaluating a couple of such terms, I got
$$\sum_{k=1}^{n-1}f(k)\sim\frac{\pi}{2}\sqrt n-2+\frac{1}{2}+\frac{1}{24}=\frac{\pi}{2}\sqrt n-1.4583$$
The numeric evaluation at WolframAlpha for $n=1000$ gives
$$ \sum_{k=1}^{n-1}f(k)-\frac{\pi}{2}\sqrt n\,\bigg|_{n=1000}=-1.46046$$
All this strongly resembles $\displaystyle \zeta\Big(\frac{1}{2}\Big)=-1.46035...\,\,$; at  $\,n=10000\,$ we get even better agreement.

Questions:

*

*How can we prove that $\,\,\displaystyle \lim_{n\to\infty}\Big(\sum_{k=1}^n\sqrt{\frac{1}{k}-\frac{1}{n}}-\frac{\pi}{2}\sqrt n\Big)=\zeta\Big(\frac{1}{2}\Big)\,\,$?

*Can we get next asymptotic terms (at least, several of them) analytically ?

 [/INST] Starting from the equality $ \frac{\pi}{2}\sqrt{n} = \int_{0}^{n} \sqrt{\frac{1}{x} - \frac{1}{n}} \, \mathrm{d}x$, we get
\begin{align*}
\sqrt{n}\left( S(n) - \frac{\pi}{2} \right)
&= \sum_{k=1}^{n} \sqrt{\frac{1}{k} - \frac{1}{n}} - \frac{\pi}{2}\sqrt{n} \\
&= \sum_{k=1}^{n} \sqrt{\frac{1}{k} - \frac{1}{n}} - \int_{0}^{n} \sqrt{\frac{1}{x} - \frac{1}{n}} \, \mathrm{d}x \\
&= \sum_{k=1}^{n} \int_{k-1}^{k} \biggl( \int_{x}^{k} \frac{\partial}{\partial s} \sqrt{\frac{1}{s} - \frac{1}{n}} \, \mathrm{d}s \biggr) \, \mathrm{d}x \\
&= \sum_{k=1}^{n} \int_{k-1}^{k} \biggl( \int_{k-1}^{s} \frac{\partial}{\partial s} \sqrt{\frac{1}{s} - \frac{1}{n}} \, \mathrm{d}x \biggr) \, \mathrm{d}s \\
&= -\frac{1}{2} \int_{0}^{n} \frac{s - \lfloor s \rfloor}{s^{3/2}\sqrt{1 - s/n}} \, \mathrm{d}s  \\
&= -\frac{1}{2} \int_{0}^{0.2022 n} \frac{s - \lfloor s \rfloor}{s^{3/2}\sqrt{1 - s/n}} \, \mathrm{d}s + \mathcal{O}(n^{-1/2}).
\end{align*}
Then by the dominated convergence theorem, this converges to
$$ -\frac{1}{2} \int_{0}^{\infty} \frac{s - \lfloor s \rfloor}{s^{3/2}} \, \mathrm{d}s = \zeta\left(\frac{1}{2}\right) $$
as $n \to \infty$. (Note that $\zeta(s) = -s \int_{0}^{\infty} \frac{x-\lfloor x \rfloor}{x^{1+s}} \, \mathrm{d}x $ for $0 < \operatorname{Re}(s) < 1$, see the entry 25.2.8 of DLMF.)
</s>