Let us consider the sum $$\displaystyle S_K=\sum_{n \geq \sqrt{K}}^{2 \sqrt{K}} \left\{ \sqrt {n^2-K} \right\} $$ where $K$ is a positive integer and where $\{ \}$ indicates the fractional part. If we calculate the average value of the difference between $S_K$ and $1/2 \, \sqrt{K}$ over all positive integers $K \leq N$, we have

$$\frac{1}{N} \sum_{K=1}^{N} \left( S_K- \frac{1}{2} \sqrt{K} \right)= O(1)$$

for $N \rightarrow \infty \,\,$. I am interested in this $O(1)$ term, which seems to be different from zero. Accordingly, studying the behaviour of the difference $S_K -1/2 \, \sqrt{K}\,\,\,$ over all integer values of $K$, its distribution is slightly shifted with respect to zero, and the average value seems to be $\approx -0.32... \,\,$. I tried several approaches to determine this constant term, mostly based on the Euler-Maclaurin formula, but without success. I wonder what this term is, and how it comes into this distribution.

EDIT: These are two graphs to better illustrate the question. The first one is a plot of the difference between $S_K$ and $1/2 \, \sqrt{K}\,$ vs $K$, for the first $10^4$ values of $K$. The black line is the best fitting one and is set at a value of $\approx -0.32$.
enter image description here

The second graph is a plot of the average value of $S_K - 1/2 \, \sqrt{K}\,$, calculated over the first $N$ positive integers, vs $N$. As expected according to the first graph, the average value of the difference converges towards $\approx -0.32$. enter image description here

  • $\begingroup$ Your chances for an answer would increase if people could understand what you're talking about. Do you mean the limit $S\infty$ as $K\to\infty$ of $$\displaystyle S_K=\sum_{n \geq \sqrt{K}}^{2 \sqrt{K}} \left\{ \sqrt {n^2-K} \right\} ?$$ Why do you think it exists? And if it does, the average of $|S_K-S_\infty|$ will converge to $0$, too. $\endgroup$
    – user436658
    Aug 25, 2017 at 7:10
  • $\begingroup$ Thank you for your comment. I added some details to better clarify the question. I am interested in the distribution of the difference $ S_K - 1/2 \, \sqrt{K}$ over all integer values of $K$. This difference seems to have an average value different from zero. $\endgroup$
    – Anatoly
    Aug 25, 2017 at 14:10
  • $\begingroup$ Why is the constant $2$ in $2\sqrt{K}$? Why not any $c > 1$ so the upper bound is $c\sqrt{K}$ or $(1+c)\sqrt{K}$ for $c > 0$? $\endgroup$ Aug 26, 2017 at 17:10
  • $\begingroup$ Yes, I am primarily interested in the case of constant $2$ in the upper bound, but a generalization for any $c>1$ would be appreciated. Actually, the final constant term changes with $c$. $\endgroup$
    – Anatoly
    Aug 26, 2017 at 17:41
  • 1
    $\begingroup$ With some handwaving, it seems the limit is $-\frac14\log(2+\sqrt{3}) \approx -0.3292394742312041$ $\endgroup$ Aug 27, 2017 at 4:47

1 Answer 1


The definition of $S_K$ is complicated, it is hard to figure out a full asymptotic expansion for it.
Let us look at a simpler one which we do know.

For any integer $p > 0$, consider following sum:

$$F(p) = \sum_{k=1}^p \{ \sqrt{k} \} = \sum_{k=1}^p \sqrt{k} - \sum_{k=1}^p \lfloor \sqrt{k}\rfloor\tag{*1} $$

Let $x = \sqrt{p}$, $t = \{ x \}$ and $m = x - t = \lfloor x \rfloor$.

For the first term on RHS of $(*1)$, it has following asymptotic expansion:

$$\sum_{k=1}^p \sqrt{k} \asymp \frac23 x^3 + \frac12 x + \zeta\left(-\frac12\right) + \frac{1}{24} x^{-1} -\frac{1}{1920} x^{-5} + \frac {1}{9216} x^{-9} +\cdots\tag{*2} $$ See here for one way to derive this expansion.

For the second term, we can rewrite it as

$$\begin{align} \sum_{k=1}^p \lfloor \sqrt{k}\rfloor &= \sum_{k=m^2}^p m + \sum_{\ell=1}^{m-1}\sum_{k=\ell^2}^{(\ell+1)^2-1}\ell\\ &= (p - m^2 + 1)m + \sum_{\ell=1}^{m-1} (2\ell+1)\ell = (p - m^2 + 1)m + \frac16 (m-1)m(4m+1)\\ &= (x-t)\left(x^2 - (x-t)^2 + 1 + \frac16(x-t-1)(4(x-t)+1)\right) \end{align}\tag{*3} $$ Substitute $(*2)$ and $(*3)$ into $(*1)$ and simplify, we obtain

$$F(p) = \frac12 p + A(t)\sqrt{p} + B(t) + \frac{1}{24} p^{-1/2} + \cdots\quad\text{where}\quad \begin{cases} A(t) = -(\frac13 + t - t^2)\\ B(t) = \zeta\left(-\frac12\right) + \frac56 t + \frac12 t - \frac13 t^3 \end{cases} $$ Since $\displaystyle\;\int_0^1 A(t) dt = -\frac12 \ne 0$, even after we subtract away the piece $-\frac12 p$, the sum

$$\sum_{k=1}^p \left( \{ \sqrt{k} \} - \frac12 \right) = F(p) - \frac12 p$$

is still systematically biased by a term of the form $-\frac12 \sqrt{p}$. This is the source of the $O(1)$ term you notice. To see this, let us rewrite the sum at hand in terms of $F(p)$.

Let $\theta_K = \#\{ n \in \mathbb{Z}_{+} : \sqrt{K} \le n \le 2\sqrt{K} \}$, the sum at hand can be rewritten as $$\sum_{K=1}^N \left( S_K - \frac{1}{2}\sqrt{K} \right) = \underbrace{\sum_{K=1}^N \sum_{\sqrt{K} \le n \le 2\sqrt{K}}\left(\left\{ \sqrt{n^2 - K} \right\} - \frac12\right)}_{\mathcal{I}} - \underbrace{\frac12 \sum_{K=1}^N \left(\sqrt{K} - \theta_K\right)}_{\mathcal{J}} $$ For the first term $\mathcal{I}$, we can express it using at most two $F(\cdot)$. $$\begin{align} \mathcal{I} &= \sum_{n=1}^{2\sqrt{N}}\sum_{\frac14 n^2 \le K \le \min( N, n^2 )} \left(\left\{ \sqrt{n^2 - K} \right\} - \frac12\right)\\ &= \sum_{n=1}^{2\sqrt{N}}\sum_{ \max(0,n^2 - N)\le \ell \le \frac34 n^2} \left(\left\{ \sqrt{\ell} \right\} - \frac12\right)\\ &= -\frac12\lfloor\sqrt{N}\rfloor + \sum_{n=1}^{2\sqrt{N}}\sum_{ \max(1,n^2 - N)\le \ell \le \frac34 n^2} \left(\left\{ \sqrt{\ell} \right\} - \frac12\right) \\ &= -\frac12\lfloor\sqrt{N}\rfloor + \sum_{n=1}^{2\sqrt{N}}\left[ F(p) - \frac12 p \right]_{p = \max(0,n^2-N-1)}^{\lfloor \frac34 n^2\rfloor} \end{align} $$ For the second term $\mathcal{J}$, one can show $$\sum_{K=1}^p \theta_K = \sum_{K=1}^p \left(\lfloor\sqrt{K}\rfloor + \frac12\right) + \frac12 | p - m(m+1) |$$ This implies $\mathcal{J}$ falls of like $\sqrt{N}$ and one can ignore them in the final limit $$\mathcal{J} = \frac12\sum_{K=1}^N \left(\sqrt{K} - \theta_K \right) = \frac12( A(t) - \frac12|1-2t|)\sqrt{N} + O(1)\quad\text{ where }\quad t = \{\sqrt{N}\}$$

To proceed further, we will wave our hands. We will assume

  1. only the leading term $A(t)\sqrt{p}$ in $F(p) - \frac12 p$ matters.
  2. we can average out $A(t)$ over $t$, i.e. replace $A(t)\sqrt{p}$ by $-\frac12\sqrt{p}$
  3. we can approximate the sum over $n$ by an integral over $n$

Changing variable to $n = \sqrt{N}s$, we find

$$\begin{align}\frac1N\sum_{K=1}^N \left( S_K- \frac{1}{2} \sqrt{K} \right) = \frac{\mathcal{I}}{N} + O (N^{-1/2}) &\approx -\frac{1}{2N} \left[ \int_0^{2\sqrt{N}} \frac{\sqrt{3}}{2} n dn - \int_{\sqrt{N}}^{2\sqrt{N}}\sqrt{n^2-N} dn\right]\\ &= -\frac{1}{2} \left[ \frac{\sqrt{3}}{2} \int_0^{2} s ds - \int_1^2 \sqrt{s^2 - 1}ds \right]\\ &= -\frac14\log(2+\sqrt{3}) \approx -0.3292394742312041 \end{align} $$ A number compatible with what OP described in question.

  • 1
    $\begingroup$ This is a nice answer, thank you. I will wait to accept it only to see whether someone else has different approaches to propose. $\endgroup$
    – Anatoly
    Aug 28, 2017 at 6:00
  • $\begingroup$ Thank you again for your nice solution. Could your answer be generalized to the case in which $S_k$ has an upper bound equal to $c \sqrt{K}$? If so, should the result be $1/4 \log(c+\sqrt{c^2-1})$? And similarly, could your method be used with an upper bound of higher degree, for example $cK$? $\endgroup$
    – Anatoly
    Sep 21, 2017 at 21:37
  • $\begingroup$ @Anatoly I think it is possible to generalize to $c\sqrt{K}$ but it will take sometime for me to remember what I has done and go over the algebra again. Maybe later over the weekend, but keep your fingers crossed ;-p $\endgroup$ Sep 21, 2017 at 21:46
  • 1
    $\begingroup$ @Anatoly The contribution from first term $\mathcal{I}$ is essentially the same. Under same approximation, it gives $\color{red}{-}\frac14 \log(c+\sqrt{c^2-1})$. I cannot work out the correct form of second term $\mathcal{J}$ yet but I think its contribution remains to be $O(N^{-1/2})$ and hence ignorable. $\endgroup$ Sep 24, 2017 at 4:22
  • $\begingroup$ Thank you again for your further comment. As regards the case where the upper bound is of higher degree I have just posted a new question here: math.stackexchange.com/questions/2443783/… $\endgroup$
    – Anatoly
    Sep 24, 2017 at 22:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .