Let us fix a positive integer $q$, and let us define two functions $P, Q: mathbb{N}^2 to mathbb{N}$ as follows:

$$ P(s,t) := sum_{j=1}^t leftlfloor frac{j (s-1) + t}{q} rightrfloor$$

$$ Q(s,t) := sum_{j=1}^t leftlceil frac{j (s+1) – t}{q} rightrceil$$

If we define the function $A_s(t) : mathbb{N} to mathbb{N}$ by:

$$ A_s(t) := P(s,t) – Q(s,t) $$

I claim that $A_s = A_r$ (as functions of $t$) if and only if one of the following is true:

- $s equiv r pmod{q}$
- $s equiv -r pmod{q}$
- $sr equiv 1 pmod{q}$
- $sr equiv -1 pmod{q}$

I do have a proof of both implications, but they are rather involved and a bit too technical. The hardest part is to show that $A_s = A_r$ implies one of the four bullets. I suspect that there must exist an easier argument to solve this. For example, with this notation one can deduce some straightforward identities such as:

$$P(-s,t) = -Q(s,t)$$

which helps to prove that the second bullet implies $A_s = A_r$. I am wondering if this is indeed a hard problem and technical stuff has to play a role in a proof or if I am missing a simpler proof. Even a simple proof of the fact that both the third or fourth bullet imply $A_s = A_r$ would be nice, since what I have is lengthy and ugly.