Problem

Source: India TST 2017 D3 P3

Tags: number theory, combinatorics



Prove that for any positive integers $a$ and $b$ we have $$a+(-1)^b \sum^a_{m=0} (-1)^{\lfloor{\frac{bm}{a}\rfloor}} \equiv b+(-1)^a \sum^b_{n=0} (-1)^{\lfloor{\frac{an}{b}\rfloor}} \pmod{4}.$$