# Fractional part distribution

It is known that the distribution of $$\{\sqrt{n} \}$$, evaluated over the integer values of $$n$$, is uniform in the interval $$[0,1)$$. Let us consider the sum $$S(K)=\sum_{n=1}^K \left(\{\sqrt{n}\}-\frac{1}{2} \right) \sqrt{n}$$ I noted that the average value of $$\sum_{K=1}^N S(K)$$, calculated over all integers $$N$$ and for $$N \rightarrow \infty$$, converges to $$1/4$$. I suppose that this asymmetric distribution of $$S(K)$$ with respect to zero dipends on some properties of the distribution of $$\sqrt{n} \mod 1$$, but would be happy to better understand it by a formal proof.

Intuitively, we can consider the range of $$n$$ from $$k^2$$ to $$(k+1)^2-1=k^2+2k$$. Over this range $$\lfloor \sqrt n \rfloor=k,$$ so $$\{\sqrt n\}=\sqrt n-k$$. As $$(k=\frac 12)^2=k^2+k+\frac 14$$ the terms from $$k^2$$ through $$k^2+k$$ have $$\{\sqrt n\}-\frac 12\lt 0$$ and all the terms from $$k^2+k+1$$ through $$k^2+2k$$ have $$\{\sqrt n\}-\frac 12\gt 0$$. The positive ones get to multiply the larger $$\sqrt n$$'s. On the other hand, there is one less positive term.
Here is a failed attempt: We can write your sum with the limit of $$K \to \infty$$ as $$S=\sum_{n=1}^\infty \left(\{\sqrt{n}\}-\frac{1}{2} \right) \sqrt{n} =\sum_{m=1}^\infty\sum_{n=1}^{2m}\left(\sqrt{m^2+n}-m-\frac 12\right)\sqrt{m^2+n}$$ where we have broken the sum into pieces with each integer part of the square root. Designating each term in the outer sum as $$S_m$$ we have $$S_m=\sum_{n=0}^{2m}\left(\sqrt{m^2+n}-m-\frac 12\right)\sqrt{m^2+n}\\ =\sum_{n=0}^{2m}(m^2+n)-(m+\frac 12)\sqrt{m^2+n}\\ =2m^3+\frac 12(2m)(2m+1)-\sum_{n=0}^{2m}(m+\frac 12)\sqrt{m^2+n}$$ I tried turning the sum into an integral, but it is not accurate enough.