Sum over k of Floor of Log base b of k

Theorem
Let $n \in \Z_{> 0}$ be a strictly positive integer.

Let $b \in \Z$ such that $b \ge 2$.

Then:
 * $\displaystyle \sum_{k \mathop = 1}^n \left \lfloor{\log_b k}\right \rfloor = \left({n + 1}\right) \left \lfloor{\log_b n}\right \rfloor - \dfrac {b^{\left \lfloor{\log_b n}\right \rfloor + 1} - b} {b - 1}$

Proof
From Sum of Sequence as Summation of Difference of Adjacent Terms:


 * $\displaystyle \sum_{k \mathop = 1}^n \left \lfloor{\log_b k}\right \rfloor = n \left \lfloor{\log_b n}\right \rfloor - \sum_{k \mathop = 1}^{n - 1} k \left({\left \lfloor{\log_b {(k + 1)} }\right \rfloor - \left \lfloor{\log_b k}\right \rfloor}\right)$

Let $S$ be defined as:
 * $\displaystyle S := \sum_{k \mathop = 1}^{n - 1} k \left({\left \lfloor{\log_b {(k + 1)} }\right \rfloor - \left \lfloor{\log_b k}\right \rfloor}\right)$

As $b \ge 2$, we have that:
 * $\log_b {(k + 1)} - \log_b k < 1$

As $b$ is an integer:
 * $\left \lfloor{\log_b {(k + 1)} }\right \rfloor - \left \lfloor{\log_b k}\right \rfloor = 1$

$k + 1$ is a power of $b$.

So:

Hence the result.