Problem

Source: Taiwan 1st TST 2006, 3rd independent study, problem 2

Tags: floor function, geometry, rectangle, polynomial, quadratics, number theory proposed, number theory



Let $p,q$ be two distinct odd primes. Calculate $\displaystyle \sum_{j=1}^{\frac{p-1}{2}}\left \lfloor \frac{qj}{p}\right \rfloor +\sum_{j=1}^{\frac{q-1}{2}}\left \lfloor \frac{pj}{q}\right\rfloor$.