How do I evaluate this sum(involving the floor function)? [duplicate]

This is Dirichlet's divisor summatory function $D(x)$. It is known that $$D(x) = x\log x + x(2\gamma -1) + \Delta(x)$$ and the non-leading term $\Delta(x)$ is $O(\sqrt{x})$. Forget about its closed form, even the behaviour of the non-leading term $\Delta(x)$ is a well known unsolved problem.

Dirichlet divisor problem

Find the smallest value of $\theta$ for which $\Delta(x) = O(x^{\theta+\epsilon})$ holds true for all $\epsilon > 0$.


$$\sum_{i=1}^N \left \lfloor \frac{N}{i}\right\rfloor \approx \sum_{i=1}^N \frac{N}{i} = N\sum_{i}^N \frac1{i} = NH_N$$

where $H_n$ is the nth Harmonic number.

For any monotonically decreasing function $f$ we have,

$$\int_1^{n+1}f(x)\,{\rm d}x \le \sum_{i=1}^n f(i) \le 1+\int_1^nf(x)\,{\rm d}x$$

Taking $f(x)=\frac1{x}$, we obtain the well known bound,

$$\ln(n+1)\le H_n\le 1+\ln(n)$$

Thus $H_n \sim \ln(n)$

and our sum is $$S=N\ln(N)$$

Note: $H_n=\ln(n) + \gamma$ is a better approximation, where $\gamma$ is the Euler Mascheroni Constant.


We can always say that

$$N\ln(N+1) \le S \le N + N\ln(N)$$


The sequence $a_n=\sum_{k=1}^{n}\left\lfloor\frac{n}{k}\right\rfloor$ is integer sequence A006218 in the OEIS. It is equal to a function called the divisor summatory function; i.e., it is equal to the sum over the divisor function:

$$a_n=\sum_{k=1}^{n}\left\lfloor\frac{n}{k}\right\rfloor=\sum_{k=1}^{n}d(k)=D(n).$$