pull down to refresh

What does this sum S equal to?
S = \lfloor \sqrt{1} \rfloor + \lfloor \sqrt{2} \rfloor + \lfloor \sqrt{3} \rfloor + ... + \lfloor \sqrt{2024} \rfloor
Note that \lfloor x \rfloor refers to the floor value of x, i.e. \lfloor pi \rfloor = 3
This page might be useful at some point if you encounter a sum of powers.
Previous iteration: #758044 (several correct answers where indeed, prisoner 2 is the one that speaks, naming the opposite color to the one in front of him).
Well the root of 2024 is greater than 42, so it's probably a trick question with no real answer.
reply
I figure this would be a fun one to try and code in one line :)
np.sum(np.floor(np.sqrt(np.arange(1,2025,1))))
Answer: 59730
reply
reply
If we write down the floor values we see
S = 1 + 1 + 1 + 2 + 2 + 2 + 2 + 2 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 4 + ... + 44
(note how, conveniently, \sqrt{2024} is just at the border between 44 and 45) or
S = \sum_{k=1}^{44}{k \times (2k + 1)}
or
S = 2 \times \sum_{k=1}^{44}{k^2} + \sum_{k=1}^{44}{k}
and then using the Sums of powers formula from the suggested page
S = 2 \times \frac{44^3}{3} + \frac{44^2}{2} + \frac{44}{6} + \frac{44*45}{2} = 59730
reply