It is well-known that $$\frac{1}{1}-\frac{1}{2}+\frac{1}{3}-\frac{1}{4}+\cdots = \ln 2 $$ Hence $$\frac{x}{1}-\frac{x}{2}+\frac{x}{3}-\frac{x}{4}+\cdots= x\ln 2 $$ However, consider $f(x)$, where $$f(x)=\left\lfloor\frac{x}{1}\right\rfloor-\left\lfloor\frac{x}{2}\right\rfloor+\left\lfloor\frac{x}{3}\right\rfloor-\left\lfloor\frac{x}{4}\right\rfloor+\cdots $$ and $\lfloor t\rfloor$ denotes the floor function. Can anyone determine and prove the asymptotic behaviour of $f(x)$? Maybe even a good error term as well or even the second term in the asymptotic expansion? I'm guessing that $$ f(x) \sim x \ln 2$$ but cannot prove it.
Edit: I believe I may have solved my own problem. The infinite sum is equal to the limit of the partial sum as the amount of terms tends to infinity. The first $n$ terms can be approximated by dropping the floor function signs at a cost of an error of $O(n)$, leaving one with $$\frac{x}{1}-\frac{x}{2}+\frac{x}{3}-\frac{x}{4}+\cdots + (-1)^{n+1}\frac{x}{n} + O(n)$$ The alternating sum multiplied by $x$ is almost $ x \ln 2$ and the error in approximating the partial sum as the infinite sum is $O(\frac{1}{n})$, since the series is alternating. Hence, the error introduced by approximating $$ \frac{x}{1}-\frac{x}{2}+\frac{x}{3}-\frac{x}{4}+\cdots + (-1)^{n+1}\frac{x}{n}$$ as $x \ln 2$ is $O(\frac{x}{n})$ and so the nth partial sum is equal to $$ x \ln2 + O\left(\frac{x}{n}\right) + O(n)$$ But $n$ is independent of $x$ and so we minimise the error by letting $n=\sqrt x$ giving the final result $$f(x)= x \ln2 + O(\sqrt x) $$ I believe I have made no mistake in this solution.