TITLE: How close can $\sum_{k=1}^n \sqrt{k}$ be to an integer?
QUESTION [36 upvotes]: How close can
$S(n) = \sum_{k=1}^n \sqrt{k}$
be to an integer?
Is there some $f(n)$ such that,
if $I(x)$ is the closest integer to $x$,
then $|S(n)-I(S(n))|\ge f(n)$
(such as $1/n^2$, $e^{-n}$, ...).
This question was inspired by the recently proposed and answered question of
"prove that $\sum_{k=1}^n \sqrt{k}$
is never an integer/".
The question is here: Is $\sqrt1+\sqrt2+\dots+\sqrt n$ ever an integer?
The Euler-Maclaurin estimate for $S(n)$
might be useful.
According to an answer here,
(the link is "How to calculate the asymptotic expansion of $\sum \sqrt{k}$?")
$$S(n) =  \frac{2}{3} n^{3/2} + \frac{1}{2} n^{1/2} + C + \frac{1}{24} n^{-1/2} + O(n^{-3/2})$$
where
$C=\zeta(-\frac 12)\approx-0.207886224977...$.

REPLY [4 votes]: Contrary to the numbers obtained by the clever approach of @user26872, The sequence of "best values up to this point" for numbers $m$ such that $\sum_1^m\sqrt{n}$ is closer to an integer than it is for any smaller $n$, is
$$
\{ 3, 13, 22, 33, 38, 41, 54, 156, 761, 10869, 41085, 142625, 224015, 898612, 2750788 \ldots\}
$$
For example, 
$\sum_1^{156}\sqrt{n} \approx 1305.000314$ and 
$\sum_1^{10869}\sqrt{n} \approx 755479.999989$ and 
$\sum_1^{2750788}\sqrt{n}$ is only $3.0776 \cdot 10^{-8}$ more than an integer.
Of these best values, only $38$ is on the list given in the other answer.
The observation is that you can get better approaches to an integer by allowing the leading terms to stray off of integer values, in clever ways that almost cancel the lower order terms.