# Sum over k to p over 2 of Floor of 2kq over p

## Theorem

Let $p \in \Z$ be an odd prime.

Let $q \in \Z$ be an odd integer.

Then:

$\displaystyle \sum_{0 \mathop \le k \mathop < p / 2} \floor {\dfrac {2 k q} p}r \equiv \sum_{0 \mathop \le k \mathop < p / 2} \floor {\dfrac {k q} p} \pmod 2$

## Proof

When $k < \dfrac p 4$ we have:

 $\displaystyle \floor {\dfrac {\paren {p - 1 - 2 k} q} p}$ $=$ $\displaystyle q - \ceiling {\dfrac {\paren {2 k + 1} q} p}$ $\displaystyle$ $=$ $\displaystyle q - 1 - \floor {\dfrac {\paren {2 k + 1} q} p}$ $\displaystyle$ $\equiv$ $\displaystyle \floor {\dfrac {\paren {2 k + 1} q} p}$ $\displaystyle \pmod 2$

Thus it is possible to replace the last terms:

$\floor {\dfrac {\paren {p - 1} q} p}, \floor {\dfrac {\paren {p - 3} q} p}, \ldots$

by:

$\floor {\dfrac q p}, \floor {\dfrac {3 q} p}, \ldots$

The result follows.

$\blacksquare$