# Dedekind-esque sums

Given real numbers $a, b$, let $f(x)$ be the integer nearest to $ax+b$, let $S_n$ be $\sum_{k=0}^{n} (n-2k) f(n-k) = n f(n) + (n-2) f(n-1) + (n-4) f(n-2) + ... - (n-2) f(1) - n f(0)$, and let $s_n = an(n+1)(n+2)/6$ (the value you would get if you replaced each term $f(x)$ in the sum by the associated $x$). I believe (with no especially good evidence) that for a set of real numbers $a$ of full measure, and for all real numbers $b$, $|S_n - s_n|$ is $O(n)$. Is this true?

This is an updated version of the question "sums involving the nearest-integer function" that I posted a couple of weeks ago. One person who replied to that post appeared to be claiming that if $a$ is any irrational number and $b = 0$ then $|(S_n - s_n)/n|$ is unbounded. Can anyone provide a proof, or steer me towards a proof in the on-line literature? (I tried $a = (1+\sqrt{5})/2$ and $b = 0$, and I found that $\max_{n \leq N} |(S_n - s_n)/n|$ takes on the successive values 0.59, 0.81, 0.81, and 1.10 for $N = 10,10^2,10^3,$ and $10^4$.)

When $a$ is rational, it is easy to show that $|S_n - s_n|$ is $O(n)$. In this case, are there good bounds of the form $Cn$ for explicit constants $C$ (presumably obtained from the continued fraction expansion of $a$)?

-
What happens if you rewrite $f(x)$ as $[ax+b+(1/2)]$, which is $ax+b+(1/2)-\{ax+b+(1/2)\}$? You get a main term and then a term involving a sum with fractional parts, which may be in the literature. –  Gerry Myerson May 13 '10 at 23:54
Further to my comment, you get $S_n-s_n=-\sum_{r=0}^n(2r-n)\{ar+b'\}$ where $b'=b+(1/2)$. I suspect this is in the discrepancy literature. –  Gerry Myerson May 14 '10 at 1:36
You may find what you need among the answers at mathoverflow.net/questions/17132/… –  Gerry Myerson May 14 '10 at 23:30