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:
 * $\ds \sum_{k \mathop = 1}^n \floor {\log_b k} = \paren {n + 1} \floor {\log_b n} - \dfrac {b^{\floor {\log_b n} + 1} - b} {b - 1}$

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


 * $(1): \quad \ds \sum_{k \mathop = 1}^n \floor {\log_b k} = n \floor {\log_b n} - \sum_{k \mathop = 1}^{n - 1} k \paren {\floor {\map {\log_b} {k + 1} } - \floor {\log_b k} }$

Let $S$ be defined as:
 * $\ds S := \sum_{k \mathop = 1}^{n - 1} k \paren {\floor {\map {\log_b} {k + 1} } - \floor {\log_b k} }$

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

As $b$ is an integer:
 * $\lfloor {\map {\log_b} {k + 1} } - \floor {\log_b k} = 1$

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

So:

The result follows by substituting $S$ back into $(1)$ and factoring out $\floor {\log_b n}$.