Thomas and Nils are playing a game. They have a number of cards, numbered $1, 2, 3$, et cetera. At the start, all cards are lying face up on the table. They take alternate turns. The person whose turn it is, chooses a card that is still lying on the table and decides to either keep the card himself or to give it to the other player. When all cards are gone, each of them calculates the sum of the numbers on his own cards. If the difference between these two outcomes is divisible by $3$, then Thomas wins. If not, then Nils wins. (a) Suppose they are playing with $2018$ cards (numbered from $1$ to $2018$) and that Thomas starts. Prove that Nils can play in such a way that he will win the game with certainty. (b) Suppose they are playing with $2020 $cards (numbered from $1$ to $2020$) and that Nils starts. Which of the two players can play in such a way that he wins with certainty?
Problem
Source: Dutch NMO 2019 p5
Tags: combinatorics, game strategy, winning positions, divisible, Difference