Where's my mistake applying Perron's Formula?

I applied Perron's Formula to Riemann Zeta Function and got a weird result.

First, I started with a simple definition of Riemann Zeta Function, $$\zeta(s)=\sum_{n=1}^{\infty}\frac{1}{n^{s}}$$ where $\Re(s)>1$. Applying Perron's Formula, $$\sum_{n\leq x}'\frac{1}{n^s}=\frac{1}{2\pi i}\int_{c-i\infty}^{c+i\infty}\zeta(s+z)\frac{x^z}{z}dz$$ for $c>0$. $\sum'$ means that the last term of the sum should be multiplied by 1/2 when $x$ is an integer. We can calculate the integral easily using Residue Theorem. We have $$\frac{1}{2\pi i}\int_{c-i\infty}^{c+i\infty}\zeta(s+z)\frac{x^z}{z}dz=\zeta(s)+\frac{x^{1-s}}{1-s}$$ since $$\underset{z=0}{\mathrm{Res}}\ \zeta(s+z)\frac{x^z}{z}=\lim_{z\rightarrow0}z\left(\zeta(s+z)\frac{x^z}{z}\right)=\zeta(s)$$ and $$\underset{z=-s+1}{\mathrm{Res}}\ \zeta(s+z)\frac{x^z}{z}=\lim_{z\rightarrow1-s}(s+z-1)\left(\zeta(s+z)\frac{x^z}{z}\right)=\frac{x^{1-s}}{1-s}.$$ Actually this is a weird result.

In fact, it is true that $$\sum_{n\leq x}\frac{1}{n^{s}}=\zeta(s)+\frac{x^{1-s}}{1-s}+O\left(x^{-s}\right)$$ but both side except the error term cannot be equal.

• When you use residue theorem on $\int_{-\infty}^{\infty}$, you should always be careful. I suggest truncation of integral and use residue theorem inside a finite region. – i707107 Jul 8 '13 at 5:57
• The residue theorem works for closed contours. You're trying to apply it to a vertical line; that's not always going to work. (What makes you sum the residues to the left of the line, instead of those to the right, for example?) – Greg Martin Jul 8 '13 at 7:02
• Thanks. Now I realized what was going wrong. – Flan Jul 8 '13 at 9:42
• See this second formula with the error terms. – Raymond Manzoni Jul 8 '13 at 10:04
• To be specific, this line is false: $$\frac{1}{2\pi i}\int_{c-i\infty}^{c+i\infty}\zeta(s+z)\frac{x^z}{z}dz=\zeta(s)+\frac{x^{1-s}}{1-s},$$ because the contour integration has not been done correctly. – Eric Naslund Jul 8 '13 at 17:22