I'm trying to get a closed form of this equation:
$$ \sum_{i=1}^{n} \left \lfloor{\log{i}}\right \rfloor $$
I know that
$$ \sum_{i=1}^{n} {\log{i}} = \log{n!}$$
But I'm confused about how the floor operator affects this and just adding the floor operator seems to break down after trying a few small examples.
Thanks!
Throughout, $\log$ is assumed to be $\log_{10}$.
Note that
$\lfloor\log k \rfloor = 0, \ \ (k=1,2,...,9)$
$\lfloor\log k \rfloor = 1, \ \ (k=10,11,...,99)$
$...$
$\lfloor\log k \rfloor = m, \ \ (k=10^m,...,10^{m+1}-1), \ \ m \in \mathbb{Z}_{\ge 0}$
Thus, number of $k$'s such that $\lfloor\log k \rfloor = m \ \ $ is $ \ \ (10^{m+1}-1)-(10^m-1)=9\cdot10^m$.
Therefore, $$\sum_{i=1}^n\lfloor \log i \rfloor = \left[\sum_{i=0}^{\lfloor \log n \rfloor-1}i\cdot(9\cdot10^i)\right]+(m+1)(n-10^{\lfloor \log n \rfloor}+1)$$
Now, it shouldn't be difficult to work with the last sum.