# the sum of fractional parts times the ordinary powers

Is there any way to compute/express $\sum\limits^m_{i=0}\{\frac{q*i}{m}\}(\frac{i}{m})^n$ ? Here $q,m,n$ are natural numbers, one can assume $gcd(q,m)=1$. Furthermore, $n$ can be treated as a parameter, i.e. I will be quite happy to know the formula for each particular $n$. At least for say $0<n<5$.

Maybe in this general case no good answer is possible, but I hope that the following combination behaves better:
$\sum\limits^{m_1}_{i=0}\{\frac{-m_2*i}{m_1}\}(\frac{i}{m_1})^n-\sum\limits^{m_2}_{i=0}\{\frac{m_1*i}{m_2}\}(\frac{i}{m_2})^n$.

(with the convention $\{-x\}=\{1-x\}$)

In fact I'm interested in this later combination. By interpolation I've guessed the following answers:

for $n=1$ the sum is: $\frac{3+3(m_1-m_2)-\frac{1}{m_1m_2}-\frac{m_1}{m_2}-\frac{m_2}{m_1}}{12}$.

for $n=2$ the sum is: $\frac{3+2(m_1-m_2)-\frac{1}{m_1m_2}-\frac{m_1}{m_2}-\frac{m_2}{m_1}+\frac{1}{m_1}-\frac{1}{m_2}}{12}$.

(Here I assume $gcd(m_1,m_2)=1$, otherwise one has a simple correction term. I do not know any analytic proof, just that numerically these formulas give the correct answer.)

This looks quite promising, but already for $n=3$ I could not guess the answer. Though I hope that for every $n$ the expression can be written as a rational function of $m_1,m_2$ plus some $gcd(m_1,m_2)$ correction.

• The case $n=1$ certainly looks like the Dedekind sum $s(q,m)$, and the two-term combination looks like the reciprocity formula for that Dedekind sum. There are all kinds of "generalized Dedekind sums" out there, and your $n>1$ cases may have been studied as such a generalization. Apostol studied $$s_p(h,k)=\sum_{\mu=1}^{k-1}{\mu\over k}B_p\left({h\mu\over k}\right)$$ where $B_p(x)$ is a Bernoulli function, the periodic version of the $p$th Bernoulli polynomial. – Gerry Myerson Aug 30 '16 at 12:37
• @DmitryKerner in general, idea is the following. We consider integer points in the rectangle $[0,m_1]\times [0,m_2]$ and sum up the values of some function $F(x,y)$ over these points. Partition all points onto two sets by diagonal $y/m_2=x/m_1$. When we consider the points below the diagonal, fix $x$, then $y$ varies from 0 to $[m_2/m_1 x]$, for the points above the diagonal fix $y$. This partition gives a series of identities which should give what your need for appropriate $F$. I think that $F(x,y)=u(x)v(y)$ should work for appropriate $u,v$. – Fedor Petrov Aug 30 '16 at 13:03
As Gerry already commented, your formulas are equivalent to a reciprocity theorem of Tom Apostol; see, e.g., the bibliography in this paper (Apostol's paper is too old to be on the arXiv): Your sums are of the form $s_n(a,b) + s_n(b,a)$ where $$s_n(a,b) = \sum_{m=1}^b \left\{\frac{ma}b\right\} \left\{\frac m b\right\}^n$$ where $\{x\}$ is the fractional part function. Note that $s_n(a,b) = \sum_{m=1}^b \{\frac mb\} \{\frac{ma^{-1}}b\}^n$ where $a^{-1}$ is the inverse of $a$ mod $b$, whence $s_n(a,b)$ is a sum of Dedekind-Apostol sums, which are of the form $$\sum_{m=1}^b \left\{\frac mb\right\} B_n\left(\left\{\frac{ma}b\right\}\right)$$ where $B_n(x)$ is the $n$th Bernoulli polynomial.