Problem

Source: Bulgarian Autumn Tournament 2022 11.4

Tags: combinatorics



The number $2022$ is written on the white board. Ivan and Peter play a game, Ivan starts and they alternate. On a move, Ivan erases the number $b$, written on the board, throws a dice which shows some number $a$, and writes the residue of $(a+b) ^2$ modulo $5$. Similarly, Peter throws a dice which shows some number $a$, and changes the previously written number $b$ to the residue of $a+b$ modulo $3$. The first player to write a $0$ wins. What is the probability of Ivan winning the game?