When, for arbitrary positive integers $m$ and $n$, is the following sum equal to $0$?
$$ \sum_{i=0}^{mn-1} (-1)^{\lfloor i/m \rfloor +\lfloor i/n\rfloor} $$
When, for arbitrary positive integers $m$ and $n$, is the following sum equal to $0$?
$$ \sum_{i=0}^{mn-1} (-1)^{\lfloor i/m \rfloor +\lfloor i/n\rfloor} $$
The sum is $0$ if and only if $m$ and $n$ contain different numbers of factors of $2$.
If neither contains a factor of $2$, the number of summands is odd, so the sum can't be $0$.
If both contain a factor of $2$, let $m=2k$ and $n=2l$, and $i=2kla+2b+c$ with $a,c\in\{0,1\}$ and $0\le b\lt kl$. Then
$$ \left\lfloor\frac im\right\rfloor=\left\lfloor\frac{2kla+2b+c}{2k}\right\rfloor=2la+\left\lfloor\frac bk\right\rfloor $$
and likewise
$$ \left\lfloor\frac in\right\rfloor=\left\lfloor\frac{2kla+2b+c}{2l}\right\rfloor=2ka+\left\lfloor\frac bl\right\rfloor\;, $$
so we just get $4$ times the contributions for the case $k,l$ for the $4$ different pairs of values of $a$ and $c$.
Thus, by induction we can divide out common factors of $2$. That leaves the case where one of $m$ and $n$ is even and the other is odd. In this case $i\to mn-1-i$ flips the parity of the exponent, and thus the sign of the summand, so the sum is $0$.