IMO 1977 SL 3

Let a and b be natural numbers and let q and r be the

IMO 1977 SL 3

Origin: FRG

Problem

Let a and b be natural numbers and let q and r be the quotient and remainder respectively when a2 + b2 is divided by a + b. Determine the numbers a and b if q2 + r = 1977.