I want to find out the best way to perform a concret summation. I know for instance that:
$$ \sum_{i=1}^{p}\left \lfloor \sqrt{i} \right \rfloor=\int_{1}^{p+1}\left \lfloor \sqrt{i} \right \rfloor di $$ and then $$ \int_{1}^{p+1}\left \lfloor \sqrt{i} \right \rfloor di=1/6\left (\left \lfloor \sqrt{p+1} \right \rfloor \right )\left ( 6p+5-2\left \lfloor \sqrt{p+1} \right \rfloor^{2}-3\left \lfloor \sqrt{p+1} \right \rfloor \right ) $$ I would like to know the best way to compute $$ \sum_{i=1}^{p}\left \lfloor \sqrt{ip} \right \rfloor $$ Is there an exact formula, like in the first case? If not, what would be the fastest method?