# What is $\lim_{x\to \infty} 2\sqrt{x}- \sum_{n=1}^x {1\over \sqrt{n}}$? [duplicate]

I ask this because I noticed the partial sum $\sum_{n=1}^x {1\over \sqrt{n}}$ is very close to $2\sqrt{x}$, so close in fact that it appears their difference approaches a constant value, like $H_x$ and $\ln x$. However, when I put this limit as is into Wolfram, it said the limit diverged.

But, I found a way to transform the limit into an infinite sum, by using the transformation $f(x) = f(0) + \sum_{n=1}^x f(n) - f(n-1)$, an application of telescoping series to partial sums.

Thus, \begin{align*}\lim_{x\to \infty} \left(2\sqrt{x}- \sum_{n=1}^x {1\over \sqrt{n}} \right) &= \lim_{x\to \infty} \left( 2\sqrt{0} + \sum_{n=1}^x \left( 2\sqrt{n} - 2\sqrt{n-1} \right) - \sum_{n=1}^x {1\over \sqrt{n}} \right) \\ &= \sum_{n=1}^{\infty} \left(2\sqrt{n} - 2\sqrt{n-1} -{1\over \sqrt{n}} \right) \end{align*}

This sum converges according to Wolfram by comparison test, and according to me by the integral test, but what does it converge to? It converges incredibly slowly; my best guess is $\approx 1.458$

## marked as duplicate by Antonio Vargas, Roland, Clement C., Claude Leibovici, NikunjMay 25 '16 at 6:32

• $x$ is integer, right? – Chip May 25 '16 at 4:58
• @Chip That's correct – Rob Bland May 25 '16 at 4:59
• I suggest taking a look at the Euler-Maclaurin summation formula. – carmichael561 May 25 '16 at 5:03
• If you bound the sum up and down by using the Riemann integral sum for $1/\sqrt x$, the limit is constraint between $0$ and $2$. Otherwise, how about trying to sum it using the complex analysis trick for summing series ? – Chip May 25 '16 at 5:07
• See also this and this. – Antonio Vargas May 25 '16 at 5:29

May be, we could use generalized harmonic numbers since $$\sum_{n=1}^x {1\over \sqrt{n}}=H_x^{\left(\frac{1}{2}\right)}$$ and use the asymptotics for large values of $n$ $$H_x^{\left(\frac{1}{2}\right)}=2 \sqrt{x}+\zeta \left(\frac{1}{2}\right)+\frac 1 {2\sqrt x}+O\left(\frac{1}{x^{3/2}}\right)$$

• This is neat, but it doesn't answer the question of why $\sum_{n=1}^x \left(\frac{2}{\sqrt n + \sqrt{n-1}} - \frac{1}{\sqrt n}\right) \to H_x^{(1/2)}$ as $x \to \infty$. – Yakov Shklarov May 25 '16 at 5:26
• I don't agree this is a duplicate, since I don't agree the other question has been answered. in my opinion the answer is that $\zeta(s) = -s \int_0^\infty (x - \lfloor x \rfloor ) x^{-s-1}dx$ for $Re(s) \in ]0,1[$ – reuns May 26 '16 at 6:04

use that $$\sum_{k=1}^n k^{-1/2} = \int_{1-\epsilon}^{n+\epsilon} \left(\sum_{k=1}^n \delta(x-k)\right) x^{-1/2} dx = n^{1/2} + \frac{1}{2}\int_1^n \lfloor x \rfloor x^{-3/2} dx$$ (some sort of integration by parts, see Abel's summation formula )

while $$n^{1/2} = 1+\frac{1}{2}\int_1^n x^{-1/2} dx$$

hence

$$A_n = 2 n^{1/2}-\sum_{k=1}^n k^{-1/2} = 1 + \frac{1}{2}\int_1^n (x-\lfloor x \rfloor) x^{-3/2} dx = \frac{1}{2}\int_0^n (x-\lfloor x \rfloor) \,x^{-3/2} dx$$

and for $Re(s) \in \ ]0,1[$ (using the same trick as above) $$\zeta(s) = -s\int_0^\infty (x-\lfloor x \rfloor ) \,x^{-s-1} dx$$ we get

$$\lim_{n \to \infty} A_n = \frac{1}{2}\int_0^\infty (x-\lfloor x \rfloor) \,x^{-3/2} dx = - \zeta(1/2) \approx 1.460355$$

Too lazy to whip up anything fancy, but

program z2
use ISO_FORTRAN_ENV,only:wp=>REAL128
real(wp) zeta,x
integer k, M
M = 100000000
zeta = sum([(1/sqrt(real(k,wp)),k=1,M)])- &
2*sqrt(M+0.5_wp)-1/(48*sqrt(M+0.5_wp)**3)
write(*,*) zeta
end program z2


Spits out $-1.46035450880958681288949915247298$, which has $29$ digits of $\zeta\left(\frac12\right)$ correct. What you are doing amounts to analytical continuation of the Riemann zeta function.

You want proof? OK, all I can remember about the midpoint rule is that $$\int_0^1f(x)dx=f\left(\frac12\right)+Cf^{\prime\prime}(\xi)$$ For some $\xi\in(0,1)$. I can never remember the value of $C$, but if $f(x)=\frac12\left(x-\frac12\right)^2$, then $$\int_0^1f(x)dx=\frac12\frac13\frac18(2)=\frac1{24}=f\left(\frac12\right)+Cf^{\prime\prime}(\xi)=0+C\cdot1=C$$ So then we can say that \begin{align}\sum_{k=1}^Nf(k)&=\sum_{k=1}^Mf(k)+\sum_{k=M+1}^Nf(k)\\ &=\sum_{k=1}^Mf(k)+\int_{M+\frac12}^{N+\frac12}f(x)dx-\frac1{24}\sum_{k=M+1}^Nf^{\prime\prime}(\xi_k)\\ &=\sum_{k=1}^Mf(k)+2\sqrt{N+\frac12}-2\sqrt{M+\frac12}-\frac1{24}\sum_{k=M+1}^Nf^{\prime\prime}(\xi_k)\end{align} There is a mean value theorem that allows you to bound $$-\frac1{24}\sum_{k=M+1}^Nf^{\prime\prime}(\xi_k)$$ by $$-\frac1{24}\int_{M+\frac12}^{N+\frac12}f^{\prime\prime}(x)dx=-\frac1{24}\left[f^{\prime}\left(N+\frac12\right)-f^{\prime}\left(M+\frac12\right)\right]$$ To within a little variation of the endpoints. For the Riemann zeta function, $\zeta(s)$ with $\Re s>1$, this accelerates convergence but more importantly taking the limit as $N\rightarrow\infty$ just mean throwing out all the upper bound terms. The term with $M$, however makes the whole thing converge for $\Re s>0$ and so provides analytical continuation of the Riemann zeta function. I retained the $$\frac1{24}f^{\prime}\left(M+\frac12\right)=-\frac1{48}\left(M+\frac12\right)^{-3/2}$$ term in my program because it's the right next-order term and helps convergence along. Thus I was approximating $$\zeta\left(\frac12\right)\approx\sum_{k=1}^M\frac1{\sqrt k}-2\sqrt{M+\frac12}-\frac1{48}\left(M+\frac12\right)^{-3/2}$$ So this not only provides analytical continuation but accelerates convergence. Whoops, I see that I had the wrong sign on that last term, here let me fix it... now it's good to $29$ digits, that's more like it!

• Yep, I was just about to fix that, but I have completed one sweep of proofreading by now. – user5713492 May 25 '16 at 6:13
• are you sure it is not $-1/2$ ? seems weird that there is no $-1/2$ term – reuns May 25 '16 at 6:13
• There are a bunch of $-\frac12$ terms in the partial sums, but the beauty of the midpoint form of the Euler-MacLaurin summation formula is that the low order terms are a little smaller and that zero-order term present in the trapezoidal rule form gets scrubbed out. – user5713492 May 25 '16 at 6:16