calculating sum of floor function regardless of greatest common divisor

161 Views Asked by At

I hope something good happens to you.

we denote that $\lfloor x \rfloor$ is floor function and $(a, b):=d$ is greatest common divisor between $a$, $b$.

we know that

$$\sum_{i=1}^{b-1} {\left\lfloor \frac{ai}{b}\right\rfloor}=\frac{(a-1)(b-1)}{2}+\frac{d-1}{2}$$

where positive integer $a$, $b$. But it depends on $d$.

Here is my question.

Is there any theorem calculating $\displaystyle\sum_{i=1}^{b-1} {\left\lfloor \frac{ai}{b}\right\rfloor}$ regardless of $d$?