Problem

Source: Baltic Way 2017 Problem 20

Tags: number theory



Let $S$ be the set of all ordered pairs $(a,b)$ of integers with $0<2a<2b<2017$ such that $a^2+b^2$ is a multiple of $2017$. Prove that \[\sum_{(a,b)\in S}a=\frac{1}{2}\sum_{(a,b)\in S}b.\] Proposed by Uwe Leck, Germany