Perron's formula Is it possible to show (the trivial statement)
$\sum _{n\leq x}1=x+\mathcal O\left (1\right )$
using Perron's formula?
For $c$ a little bigger than $1$ and $1>c'>0$, a quantitative form of Perron's formula and then the Residue Theorem implies (with some parameter $T>0$)
$\begin {eqnarray*}
\sum _{n\leq x}1&=&\frac {1}{2\pi i}\int _{c-iT}^{c+iT}\frac {\zeta (s)x^sds}{s}+E_1
\\ &=&x+\frac {1}{2\pi i}\int _{c'-iT}^{c'+iT}\frac {\zeta (s)x^sds}{s}+E_2+E_1,
\end {eqnarray*}$
where $E_1$ is around $x/T$ and $E_2$ is the two horizontal integrals between the above two.
Since $\zeta (s)$ is around $t^{1/2-\sigma }$ in size in $(0,1/2)$  we obviously can't take the modulus signs directly inside.  Are there any results that take account this cancellation over the integral?  (And just as a safety check: the horizontal contributions can't give extra cancellation, right?)
Perhaps applying the functional equation we may be able to compute the integral explicitly?
Cheers.
 A: One could try to not even bother with the cut-offs and just integrate over the complete vertical line:
$$\sum_{n \leq x}' 1 = \frac 1{2\pi i} \int_{(c)} \zeta(2s) x^{2s} \frac{ds}s$$ for some $\frac 12 < c < \frac 34$.
Next, we shift the contour to some negative number, $-(c-\frac 12)$ say, and apply the functional equation of the zeta function. Picking up residues on the way yields
$$\frac 1{2\pi i} \int_{(c)} \zeta(2s) x^{2s} \frac{ds}s = x - \tfrac 12 + \frac 1{2\pi i} \int_{(c)} \zeta(2s) \frac{\Gamma(s)}{\Gamma(\frac 32-s)} x^{1-2s}\pi^{\frac 12- 2s} ds.$$
We would like to the exchange the order of integration and summation (in the zeta function). Unfortunately, the given integral is not absolutely convergent, so we can't just apply Fubini's theorem. We can however justify this step by showing that the limit of the integral is approached uniformly in the summation variable, but this involves some tedious application of Stirling's Formula and bounds for special Fourier-Integrals (techniques to deal with integrals of this type can be found for example in [J. Brüdern, Einführung in die analytische Zahlentheorie, p. 135f]. This is a german book, but I am sure there are similar references available in english.) Hence, we unleash our inner physicist and skip the justification.
We arrive at
$$\sum_{n \leq x}' 1 = x - \frac 12 + \sum_{n=1}^\infty x \sqrt \pi \frac 1{2 \pi i} \int_{(c)} \frac{\Gamma(s)}{\Gamma(\frac 32-s)}(x n \pi)^{-2s}ds.$$
The latter integral is of Mellin-Barnes-Type and can be interpreted as a Bessel-Function,
$$\frac 1{2 \pi i} \int_{(c)} \frac{\Gamma(s)}{\Gamma(\frac 32 -s)}(\pi n x)^{-2s}ds = (\pi n x)^{-\frac 12}J_{\frac 12}(2\pi n x),$$
which brings us to the equation
$$\frac 1{2\pi i} \int_{(c)} \zeta(2s) x^{2s} \frac{ds}s = x - \frac 12 + \sqrt x \sum_{n=1}^\infty \frac {J_{\tfrac 12}(2\pi n x)}{n^{\frac 12}}.$$
Using $J_{\frac 12}(2z) = (\pi z)^{-\frac 12} \sin(2z)$, we obtain
$$... = x - \frac 12 + \frac 1\pi \sum_{n=1}^\infty \frac{\sin(2\pi nx)}n.$$
It is well-known that for real $x$, one has
$$\sum_{n=1}^\infty \frac {\sin(nx)}n = \frac {\pi - x}2$$ if $0<x<2\pi$ and $...= 0$ if $x=0$. In addition, this expression is $2\pi$-periodic in $x$. This finally shows
$$\frac 1{2\pi i} \int_{(c)} \zeta(2s) x^{2s} \frac{ds}s = x - \{x\} - \begin{cases} \frac 12 \text{ if } x \in \mathbb N, \\ 0 \text{ otherwise.}\end{cases} = \sum_{n \leq x}' 1.$$
Concludingly, we were able to prove the powerful result
$$\sum_{n \leq x}' 1 = \sum_{n \leq x}' 1$$
using Perron's Formula.
I wouldn't be surprised if the arguments used to justify the exchange of summation and integration were strong enough to show the error term O(1) directly.
