MathLabs

Problem 5

Let a,ba,b be positive integers. Dividing a2+b2a^2+b^2 by a+ba+b gives quotient qq and remainder rr. Find all pairs (a,b)(a,b) such that q2+r=1977q^2+r=1977.
Step 3 of 4: Complete the square
a2+b2=44(a+b)+41⟹(a−22)2+(b−22)2=1009a^2+b^2=44(a+b)+41\Longrightarrow(a-22)^2+(b-22)^2=1009
Detailed analysis

Substitute q=44,r=41q=44,r=41 into the division identity and complete squares to obtain (a−22)2+(b−22)2=1009(a-22)^2+(b-22)^2=1009. Checking the integer squares at most 10091009 gives only 1009=152+2821009=15^2+28^2, up to order.