## Task B-2.4.

In how many ways can we choose two different numbers from the set $\{1,2, \ldots, 2022,2023\}$ so that their sum is divisible by 5?
## First solution.

In the set of numbers $\{1,2, \ldots, 2022,2023\}$, there are:

405 numbers that give a remainder of 1 when divided by 5

405 numbers that give a remainder of 2 when divided by 5

405 numbers that give a remainder of 3 when divided by 5

404 numbers that give a remainder of 4 when divided by 5

404 numbers divisible by 5.

1 point

The sum of two selected numbers will be divisible by 5 in three cases.

1. case: both numbers are divisible by 5.

The first number can be chosen in 404 ways, and the second in 403 ways because the numbers must be different.

There are $\frac{404 \cdot 403}{2}=81406$ ways (we divide by 2 because each pair of numbers was counted twice).

2. case: one number gives a remainder of 1, and the other gives a remainder of 4 when divided by 5.

There are $405 \cdot 404=163620$ ways to choose such two numbers.

3. case: one number gives a remainder of 2, and the other gives a remainder of 3 when divided by 5.

There are $405 \cdot 405=164025$ ways to choose such two numbers.

In total, there are $81406+163620+164025=409051$ ways to do this.