Answer:
868
Explanation:
You want the maximum length of the subset of the numbers in the range 1–2021 such that no pair has a sum divisible by 7.
Modulo 7
2021/7 = 288 5/7. That is, there are 289 numbers in the range that have remainders of 1 through 5 when divided by 7, and 288 numbers in the range that have remainders of 6 or 0 when divided by 7.
The allowed numbers in set s cannot have remainders that total 7, so cannot have remainder pairs 1,6, or 2,5, or 3,4. There can be exactly one number in set s that is divisible by 7.
Numbers in s
Since there are fewer numbers with remainder 6 than with remainder 1, we can put all the numbers with remainder 1 in set s. There are 289 of these.
Then, we can choose numbers with remainder 2 or 5, of which there are 289, and numbers with remainder 3 or 4, of which there are also 289.
Hence the size of set s will be 3×289 +1 = 868 numbers.
Set s will have a maximum of 868 elements.
__
Additional comment
The "+1" in the computation is any one of the 288 elements in the range that are divisible by 7. (If there were 2 or more, their sum would be divisible by 7, so we can't have that.)
<95141404393>