Sum over k of Floor of Root 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 {\sqrt k} = \floor {\sqrt n} \paren {n - \dfrac {\paren {2 \floor {\sqrt n} + 5} \paren {\floor {\sqrt n} - 1} } 6}$

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


 * $\ds \sum_{k \mathop = 1}^n \floor {\sqrt k} = n \floor {\sqrt n} - \sum_{k \mathop = 1}^{n - 1} k \paren {\floor {\sqrt {k + 1} } - \floor {\sqrt k} }$

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

We have that:
 * $\sqrt {k + 1} - \sqrt k < 1$

and so:
 * $\floor {\sqrt {k + 1} } - \floor {\sqrt k} = 1$

$k + 1$ is a square number.

So: