Bangladesh Mathematical Olympiad National Round Solution
Blog 05
[Problem 6, Higher Secondary 2010]:
a and b are two positive integers both less than 2010; ab. Find the number of ordered pairs (a,b) such that a2+b2 is divisible by 5.
Solution:
Let's examine the squares of integers modulo 5: 121(mod5)224(mod5)324(mod5)421(mod5)520(mod5) The pattern (1,4,4,1,0) repeats for all integers.

Identify conditions for a2+b2 to be divisible by 5:
Case 1: Both numbers square to 0 (mod 5)
Case 2: One number squares to 1 and the other to 4 (mod 5)

Since the question asks for ordered pairs, we need to double our count for both cases.

There are 402 numbers that square to 0 (mod 5) within the range 1 to 2010 because there are 402 complete blocks of 5 numbers, and in each block, the last number squares to 0 (mod 5).

For each of 1 and 4 (mod 5), there are 804 numbers within the range 1 to 2010 that square to these values. This is because there are 402 complete blocks of 5 numbers, and in each block, there are 2 numbers that square to 1 (mod 5) and 2 numbers that square to 4 (mod 5).

Answer:
(4022)×2+(8041)×(8041)×2