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} \left \lfloor{\dfrac {2 k q} p}\right \rfloor \equiv \sum_{0 \mathop \le k \mathop < p / 2} \left \lfloor{\dfrac {k q} p}\right \rfloor \pmod 2$

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

Thus it is possible to replace the last terms:
 * $\left \lfloor{\dfrac {\left({p - 1}\right) q} p}\right \rfloor, \left \lfloor{\dfrac {\left({p - 3}\right) q} p}\right \rfloor, \ldots$

by:
 * $\left \lfloor{\dfrac q p}\right \rfloor, \left \lfloor{\dfrac {3 q} p}\right \rfloor, \ldots$

The result follows.