Problem

Source: Baltic Way 2001

Tags: floor function, combinatorics proposed, combinatorics



Let $p$ and $q$ be two different primes. Prove that \[\left\lfloor\frac{p}{q}\right\rfloor+\left\lfloor\frac{2p}{q}\right\rfloor+\left\lfloor\frac{3p}{q}\right\rfloor+\ldots +\left\lfloor\frac{(q-1)p}{q}\right\rfloor=\frac{1}{2}(p-1)(q-1) \]