Problem

Source: Argentina MO 2023 Level 3 P6

Tags: number theory



There´s a ping pong tournament with $n\geq 3$ participants that we´ll call $1, 2, \dots n$. The tournament rules are the following ones: at the start, all the players form a line, ordered from $1$ to $n$. Players $1$ and $2$ play the first match. The winner is at the beginning of the line and the loser is placed behind the last person in the line.In the next play, the two who at that moment are the first two in line face each other, the winner is first in line and the loser goes to the end of the line, just behind the last loser. And so on. After $N$ matches, the tournament ends.Player number $1$ won $a_1$ matches, player number $2$ won $a_2$, and so on till player $n$, that has won $a_n$ matches (it is trivial that $a_1+a_2+\dots+a_n=N)$.Determine how many games each player has lost, based on $a_1, a_2, \dots , a_n$