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 ?

 A: Observe that
$$
\frac{{{\mathop{\rm Li}\nolimits} _{1/2}^2 (z)}}{2} = \sum\limits_{n = 2}^\infty  {S(n)z^n } , \quad |z|<1,
$$
where $\operatorname{Li}_s(z)$ is the polylogarithm. (This follows by integrating $
\frac{1}{z}{\mathop{\rm Li}\nolimits} _{ - 1/2} (z){\mathop{\rm Li}\nolimits} _{1/2} (z) = {\mathop{\rm Li}\nolimits}'_{1/2} (z){\mathop{\rm Li}\nolimits} _{1/2} (z) = \frac{1}{2}({\mathop{\rm Li}\nolimits} _{1/2}^2 (z))'
$.) The asymptotics of $S(n)$ for large $n$ is controlled by the singularity of the left-hand side at $z=1$. The polylogarithm may be expanded into a series
$$
{\mathop{\rm Li}\nolimits} _{1/2} (z) = \sqrt \pi  ( - \log z)^{ - 1/2}  + \sum\limits_{k = 0}^\infty  {\frac{{\zeta (1/2 - k)}}{{k!}}\log ^k z} 
$$
provided $|\log z|<2\pi$. This gives
\begin{align*}
\frac{{{\mathop{\rm Li}\nolimits} _{1/2}^2 (z)}}{2} & =  - \frac{\pi }{{2\log z}} + \sum\limits_{k = 0}^\infty  {( - 1)^k \sqrt \pi  \frac{{\zeta (1/2 - k)}}{{k!}}( - \log z)^{k - 1/2} }  + F(z)
\\ & = \frac{\pi }{{2(1 - z)}} + \sum\limits_{k = 0}^\infty  {( - 1)^k \sqrt \pi  \frac{{\zeta (1/2 - k)}}{{k!}}( - \log z)^{k - 1/2} }  + G(z)
\end{align*}
as $z\to 1$, where $F(z)$ and $G(z)$ are holomorphic at $z=1$. Accordingly,
$$
\sum\limits_{n = 2}^\infty  {\left( {S(n) - \frac{\pi }{2}} \right)z^n }  = \sum\limits_{k = 0}^\infty  {( - 1)^k \sqrt \pi  \frac{{\zeta (1/2 - k)}}{{k!}}( - \log z)^{k - 1/2} }  + G(z)
$$
as $z\to 1$. The behaviour of the right-hand side near $z=1$ is
$$
\sqrt \pi  \zeta (1/2)(1 - z)^{ - 1/2}  - \sqrt \pi  \left( {\zeta ( - 1/2) + \frac{{\zeta (1/2)}}{4}} \right)(1 - z)^{1/2}  + \mathcal{O}((1 - z)^{3/2} ) + \mathcal{O}(1).
$$
Singularity analysis shows that the $n$th Maclaurin coefficient of this function is
$$
\frac{{\zeta (1/2)}}{{n^{1/2} }} + \frac{{\zeta ( - 1/2)}}{{2n^{3/2} }} + \mathcal{O}\!\left( {\frac{1}{{n^{5/2} }}} \right)
$$
as $n\to +\infty$. Consequently,
$$
S(n) = \frac{\pi }{2}+\frac{{\zeta (1/2)}}{{n^{1/2} }} + \frac{{\zeta ( - 1/2)}}{{2n^{3/2} }} + \mathcal{O}\!\left( {\frac{1}{{n^{5/2} }}} \right)
$$
as $n\to +\infty$. This is in agreement with the conjectured asymptotic expansion
$$
S(n) \sim \frac{\pi }{2} + \frac{1}{{\sqrt n }}\sum\limits_{m = 0}^\infty  {\binom{m - 1/2}{m}\frac{{\zeta (1/2 - m)}}{{n^m }}} , \quad n\to +\infty.
$$
It seems that when doing the singularity analysis, many terms cancel each-other leaving us with a clean result. The proof of the general asymptotic expansion remains open for now.
A: We may use the integral version of Euler-Maclaurin formula to obtain an asymptotic formula with explicit big O error term. For any integer $a<b$ and continuously differentiable $f(x)$ on $[a,b]$ there is
$$
\sum_{k=a}^bf(k)=\int_a^bf(x)\mathrm dx+\frac12f(a)+\frac12f(b)+\int_a^b\overline B_1(x)f'(x)\mathrm dx,\tag1
$$
where $\overline B_n(x)$ denotes $n$'th periodic Bernoulli polynomial. Therefore, we see that when $a=1$, $b=n$, and $f_n(x)=\sqrt{x^{-1}-n^{-1}}$ there is
$$
\sum_{k=1}^nf_n(k)=\underbrace{\int_1^nf_n(x)\mathrm dx}_{S_1}+\frac12+\underbrace{\int_1^n\overline B_1(x){-x^{-2}\over2\sqrt{x^{-1}-n^{-1}}}\mathrm dx}_{S_2}+O\left(\frac1n\right).\tag2
$$
For $S_1$, substitution $x=nt$ gives
\begin{aligned}
n^{-1/2}S_1
&=\int_{1/n}^1\sqrt{t^{-1}-1}\mathrm dt \\
&=\int_0^1t^{1/2-1}(1-t)^{3/2-1}\mathrm dt-\int_0^{1/n}t^{-1/2}\left\{1+O(t)\right\}\mathrm dt \\
&=\frac\pi2-\int_0^{1/n}t^{-1/2}\mathrm dt+O(n^{-3/2})=\frac\pi2-2n^{-1/2}+O(n^{-3/2}),
\end{aligned}
so we have
$$
S_1=\frac\pi2\sqrt n-2+O\left(\frac1n\right)\tag3
$$
For $S_2$, note that the integral of $\overline B_1(x)$ is bounded, so integration by parts gives
\begin{aligned}
S_2
&=-\frac12\int_1^{n/2}\overline B_1(x)x^{-3/2}\left(1-\frac xn\right)^{-1/2}\mathrm dx+O(n^{-1/2}) \\
&=-\frac12\int_1^{n/2}\overline B_1(x)x^{-3/2}\left\{1+{x\over2n}+O\left(x^2\over n^2\right)\right\}\mathrm dx+O(n^{-1/2}) \\
&=-\frac12\int_1^{n/2}\overline B_1(x)x^{-3/2}\mathrm dx+O(n^{-1/2}) \\
&=-\frac12\int_1^\infty\overline B_1(x)x^{-\frac12-1}\mathrm dx+O(n^{-1/2}).
\end{aligned}
If we plug $a=1$, $b=+\infty$, and $f(x)=x^{-s}$, we have
$$
\zeta(s)=\frac12+{1\over s-1}-s\int_1^\infty\overline B_1(x)x^{-s-1}\mathrm dx.
$$
Therefore, we obtain
$$
S_2=-2-\frac12-\zeta\left(\frac12\right)+O\left(1\over\sqrt n\right).\tag4
$$
Now, plug (3) and (4) into (2), so we obtain
$$
\sum_{k=1}^n\sqrt{\frac1k-\frac1n}=\frac\pi2\sqrt n+\zeta\left(\frac12\right)+O\left(1\over\sqrt n\right).
$$
A: This supplements the answer by @Gary, to justify the asymptotics conjectured there: $$S(n)\underset{n\to\infty}{\asymp}\frac\pi2+\sum_{k=0}^{(\infty)}\binom{k-1/2}{k}\frac{\zeta(1/2-k)}{n^{1/2+k}}.$$
From the answer, we take $2\sum_{n=2}^\infty S_n z^n=f(z):=\operatorname{Li}_{1/2}^2(z)$, hence $S(n)=\frac1{4\pi i}\int_L\frac{f(z)}{z^{n+1}}\,dz$, where $L$ is any simple contour encircling $z=0$ (in the domain of analyticity of the integrand).
In our case, $f(z)$ is analytic on $\mathbb{C}\setminus\mathbb{R}_{\geqslant1}$, and we have $f(z)=O(\log|z|)$ as $z\to\infty$. So, if we take $L$ to be the circle $|z|=R$ with a notch around $\mathbb{R}_{\geqslant1}$, the integral along the circle vanishes as $R\to\infty$ (assuming $n>0$). Thus, we can replace $L$ by $L_1$, where $L_a$ is the  Hankel contour encircling $\mathbb{R}_{\geqslant a}$: $$S(n)=\frac1{4\pi i}\int_{L_1}\frac{f(z)}{z^{n+1}}\,dz\underset{z=e^w}{=}\frac1{4\pi i}\int_{L_0}e^{-nw}f(e^w)\,dw.$$
Now use $f(e^w)=\big[(-\pi/w)^{-1/2}+\sum_{k=0}^\infty\zeta(1/2-k)w^k/k!\big]^2$ for $|w|<2\pi$, noted in the answer. We replace $L_0$ by the contour consisting of the circle $|w|=r$ and the edges of the cut along $[r,\infty)$. As $r\to0$, the integral along the circle tends to $(-2\pi i)\cdot(-\pi)$, hence
$$S(n)=\frac\pi2+\int_0^\infty e^{-nx}g(x)\,dx,\qquad g(x):=\frac1{4\pi i}\lim_{t\to 0^+}\big[f(e^{x+it})-f(e^{x-it})\big].$$
From the above we get $g(x)=\pi^{-1/2}\sum_{k=0}^\infty\zeta(1/2-k)x^{k-1/2}/k!$ for $0<x<2\pi$, and the claimed asymptotics follows by Watson's lemma.
A: This does not answer the question.
Let
$$f(n)=\zeta \left(\frac{1}{2}\right)+\frac{\pi}{2}\sqrt n-\sum_{k=1}^n\sqrt{\frac{1}{k}-\frac{1}{n}}$$ Computing
$$\Delta_p=10^{p+1}\,f\left(10^p\right)$$
the results
$$\left(
\begin{array}{cc}
p & \Delta_p \\
 1 & 1.04871059298 \\
 2 & 1.04038414635 \\
 3 & 1.03952666777 \\
 4 & 1.03944068157 \\
 5 & 1.03943208058 \\
 6 & 1.03943122046 \\
 7 & 1.03943113444 \\
\end{array}
\right)$$
A: 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.)
