6. On the table, there are 2021 piles of nuts, with one nut in each pile at the beginning. Petya and Vasya are playing the following game (Petya moves first). Each move consists of combining three piles that have the same number of nuts. The player who cannot make a move loses. Who will win with correct play, and how should they play?
Answer: Petya.

Solution. Note that at the end of the game, the number of nuts in each pile will be equal to a power of three, and there will be no more than two piles of each type. Such a decomposition is unique, and the number of piles with $3^{\text {s }}$ nuts will necessarily be equal to the corresponding digit in the ternary expansion of 2021. Since $2021=2 \cdot 3^{6}+2 \cdot 3^{5}+2 \cdot 3^{3}+2 \cdot 3^{2}+3+2 \cdot 1$, there will be 11 piles at the end. With each move, exactly two piles disappear, so the number of moves is (202111)/2 $=1005$ regardless of the method of combining piles. Thus, the last move will always be made by Petya, and he will win.

Grading criteria: Correct solution - 7 points. It is stated that in each pile the number of nuts is equal to a power of three - 1 point. It is stated that there will be no more than two piles of each type - $\mathbf{1}$ point. The ternary expansion of 2021 is given - $\mathbf{1}$ point. The number of piles at the end of the game is found - $\mathbf{1}$ point. It is stated that with each move, exactly two piles disappear - $\mathbf{1}$ point. The number of moves is calculated - $\mathbf{1}$ point. Points are summed.