I'm trying to calculate for $n\in \mathbb{N}$ the following sum :
$\sum_{k=1}^{n^2}\left\lfloor \sqrt{k} \right\rfloor$.
I tried putting in the first terms, which gave me
$\sum_{k=1}^{n^2}\left\lfloor \sqrt{k} \right\rfloor=(1+2+3+\cdots+n)+\left\lfloor \sqrt{2} \right\rfloor+\left\lfloor \sqrt{3} \right\rfloor+\left\lfloor \sqrt{5} \right\rfloor+\cdots+\left\lfloor \sqrt{n^2-1} \right\rfloor$
$\iff \sum_{k=1}^{n^2}\left\lfloor \sqrt{k} \right\rfloor=\frac{n(n+1)}{2}+\left\lfloor \sqrt{2} \right\rfloor+\left\lfloor \sqrt{3} \right\rfloor+\left\lfloor \sqrt{5} \right\rfloor+\cdots+\left\lfloor \sqrt{n^2-1} \right\rfloor$.
I've been trying to somehow find a pattern between the different integer parts of the irrational numbers just like I did with the integers but I fail to success.
Is there a trick to use here or is my take wrong ?
Thank you.
The sum can be calculated as follows:
$$ \sum_{k=1}^{n^2} \lfloor \sqrt k \rfloor = 1 + 1 + 1 + \overbrace{2 + .. + 2}^{5 \space \text{terms}}+ \overbrace{3 + .. + 3}^{7 \space \text{terms}} + \overbrace{4 + .. + 4}^{9 \space \text{terms}} + .. + n $$
That reduces to: $$ 3 \times 1 + 5 \times 2 + 7 \times 4 + .. + (2n-1) \times (n-1) + n $$
The above sum is: $$ n + \sum_{k=1}^{n-1} (2n+1)\times n = \frac{n(4 n^2 - 3n + 5)}{6} $$
Which is gotten from the OEIS found by @lulu. I used the method given in the proof at the OEIS (given by J. M. Bergot), with insight from @Thomas Andrews and I believe the last equality is straightforward to prove by induction.