TITLE: Rounding is asymptotically useless?
QUESTION [32 upvotes]: Recently I came across the nice result that
$$\left\lfloor n \right\rfloor - \left\lfloor\frac{n}{2}\right\rfloor + \left\lfloor\frac{n}{3}\right\rfloor - \left\lfloor \frac{n}{4}\right\rfloor + \dots \sim n \log 2$$
where $\displaystyle a_n \sim b_n$ means $\displaystyle \lim_{n\to \infty} \frac{a_n}{b_n} = 1$.
So basically, what the above result says is that
$$\left\lfloor n \right\rfloor - \left\lfloor\frac{n}{2}\right\rfloor + \left\lfloor\frac{n}{3}\right\rfloor - \left\lfloor \frac{n}{4}\right\rfloor + \dots + (-1)^n\left\lfloor \frac{n}{n}\right\rfloor \sim n - \frac{n}{2} + \frac{n}{3} - \frac{n}{4} + \dots + (-1)^n\frac{n}{n}$$
and the fact that we take the integer part has no effect, asymptotically.
So I tried a few other sequences, like the harmonic series, and geometric series with ratio $\frac{1}{2}$, and the results seemed to be similar, but the proofs were dependent on the series in question.
So trying to generalize:
Suppose $a_1, a_2, \dots, a_n, \dots$ is a sequence of non-zero integers, such that $|a_1| \lt |a_2| \lt \dots \lt |a_n| \lt \dots$ and
$$ \sum_{k=1}^{n} \frac{1}{a_k} \sim f(n)$$
(Note that $f(n)$ can be constant).
Let $s_i$ be the sign of $a_i$ (i.e. $s_i = 1$ if $a_i \gt 0$, and $-1$ otherwise).
The question is, is the following true?

$$ \sum_{k=1}^{n} s_k \left\lfloor \frac{n}{|a_k|}\right\rfloor \sim n f(n)$$

I hope it isn't something obvious...

REPLY [8 votes]: Here is a different way to look at the proof for when $f(n)\rightarrow \infty$. We can apply the same approach as done in this answer;  since $\lfloor x\rfloor =x+O(1)$, we have that $$\sum_{k=1}^n s_k \left\lfloor \frac{n}{|a_k|}\right\rfloor = n\sum_{k=1}^n \frac{s_k}{|a_k|}+O(n)=nf(n)+O(n).$$
Hence, if $f(n)\rightarrow \infty$, we have the desired asymptotic.
Alternating series:
In the case where $a_k$ is an alternating series, we can prove the theorem by using the hyperbola method, exploiting the fact that the series alternates.
Let $b_{k}=|a_{k}|.$ Then $0<b_{1}<b_{2}<\cdots<b_{k}$  so that $b_{k}\geq k,$ and $b_k=(-1)^ka_k$. Then
$$\sum_{k\leq n}s_{k}\left[\frac{n}{|a_{k}|}\right]=\sum_{k\leq n}(-1)^{k}\sum_{d\leq n,\ b_{k}|d}1=\sum_{d\leq n}\sum_{\begin{array}{c}
k\leq n\\
b_{k}|d
\end{array}}(-1)^{k}.$$ This is then 
$$\sum_{\begin{array}{c}
db_{k}\leq n\\
k\leq n
\end{array}}(-1)^{k}=\sum_{db_{k}\leq n}(-1)^{k}$$ where we may remove the additional condition on $k$  since $k\leq b_{k}.$ Let $A>0.$ By examining the areas of various parts of the hyperbola $xy=n,$ we may split the above as $$\sum_{d\leq A}\sum_{b_{k}\leq\frac{n}{d}}(-1)^{k}+\sum_{b_{k}\leq\frac{n}{A}}\sum_{d\leq\frac{n}{b_{k}}}(-1)^{k}-\sum_{d\leq A}\sum_{b_{k}\leq\frac{n}{A}}(-1)^{k}.$$ Since $\sum_{b_{k}\leq x}(-1)^{k}=O(1),$ we see that the above is $$\sum_{b_{k}\leq\frac{n}{A}}\sum_{d\leq\frac{n}{b_{k}}}(-1)^{k}+O(A)=\sum_{b_{k}\leq\frac{n}{A}}(-1)^{k}\left[\frac{n}{b_{k}}\right]+O(A) =n\sum_{b_{k}\leq\frac{n}{A}}\frac{1}{a_{k}}+O\left(A+\frac{n}{A}\right)$$ and taking $A=\sqrt{n}$  this is
$$=n\sum_{b_{k}\leq\sqrt{n}}\frac{1}{a_{k}}+O\left(\sqrt{n}\right).$$ We may extend the above sum into $\sum_{k\leq n}\frac{1}{a_{k}}$ introducing an error term of the form $o(1)$, (which when multiplying by $n$ is $o(n)$) since the series $\sum_{k}\frac{1}{a_{k}}$  converges by the alternating series test.  This then implies that $$n\sum_{k\leq n}\frac{1}{a_k}\sim \sum_{k\leq n}s_k \left\lfloor \frac{n}{|a_k|}\right\rfloor.$$