5. On the table, there are 210 different cards with numbers $2,4,6, \ldots 418,420$ (each card has exactly one number, and each number appears exactly once). In how many ways can 2 cards be chosen so that the sum of the numbers on the selected cards is divisible by $7?$
Answer: 3135.

Solution. The given numbers, arranged in ascending order, form an arithmetic progression with a difference of 2. Therefore, the remainders of these numbers when divided by 7 alternate. Indeed, if one of these numbers is divisible by 7, i.e., has the form $7k$, where $k \in \mathbb{N}$, then the following numbers are $7k+2, 7k+4, 7k+6, 7k+8=7(k+1)+1, 7k+10=7(k+1)+3, 7k+12=7(k+1)+5$, giving remainders $2, 4, 6, 1, 3, 5$ respectively when divided by 7. Next comes the number $7k+14$, which is divisible by 7, and then the remainders repeat. Thus, the remainders of the given numbers when divided by 7 go in the order $\ldots 0; 2; 4; 6; 1; 3; 5; 0 \ldots$

Among the 210 given numbers, there are 30 numbers each that give remainders $0, 1, 2, 3, 4, 5, 6$ when divided by 7.

The sum of two numbers can be divisible by 7 in the following cases.

1) Both numbers are divisible by 7. There are 30 cards with such numbers, and we need to choose 2 of them - there are $C_{30}^{2} = \frac{1}{2} \cdot 30 \cdot 29 = 435$ ways to do this.
2) One of the numbers gives a remainder of 1 when divided by 7 - then the other must give a remainder of 6 when divided by 7. This pair of numbers can be chosen in $30 \cdot 30 = 900$ ways.
3) One of the numbers gives a remainder of 2 when divided by 7 - then the other gives a remainder of 5, and, similarly to the second case, we get 900 ways to choose 2 numbers.
4) One of the numbers gives a remainder of 3 when divided by 7 - then the other gives a remainder of 4 - also 900 ways.

In total, there are 3135 ways.