Approximation of summation of $\log x-\log n$

81 Views Asked by At

I was trying to give an asymptotic calculation for $\sum_{n\leq x}(\log x-\log n)$, and the proof provided by the instructor is that $$ \sum_{n\leq x}(\log x-\log n)=(x\log x + O(\log x))+ (x\log x+O(x))=O(x). $$ I am okay with the second "=", but don't quite understand how the first "=" comes. Can somebody explain?

1

There are 1 best solutions below

0
On

$$ \sum_{n\le x}(\log x-\log n)=\lfloor x\rfloor\log x-\sum_{n\le x}\log n $$

Since $\lfloor x\rfloor=x+\mathcal O(1)$, we have $\lfloor x\rfloor\log x=\log x+\mathcal O(\log x)$. Now it remains to expand the last term. By partial summation, we have

\begin{aligned} \sum_{n\le x}\log n &=\int_1^x\log t\mathrm dt-\{x\}\log x+\int_1^x{\{t\}\over t}\mathrm dx \\ &=[t\log t-t]_1^x+\mathcal O(\log x)+\mathcal O\left(\int_1^x{\mathrm dt\over t}\right) \\ &=x\log x-x+\mathcal O(\log x) \end{aligned}

Combining everything gives

\begin{aligned} \sum_{n\le x}(\log x-\log n) &=x\log x+\mathcal O(\log x)-[x\log x-x+\mathcal O(\log x) \\ &=x+\mathcal O(\log x)=\mathcal O(x) \end{aligned}