Problem

Source: JBMO Shortlist 2021

Tags: Junior, Balkan, shorlist, 2021, combinatorics, Process



We have a set of $343$ closed jars, each containing blue, yellow and red marbles with the number of marbles from each color being at least $1$ and at most $7$. No two jars have exactly the same contents. Initially all jars are with the caps up. To flip a jar will mean to change its position from cap-up to cap-down or vice versa. It is allowed to choose a triple of positive integers $(b; y; r) \in \{1; 2; ...; 7\}^3$ and flip all the jars whose number of blue, yellow and red marbles differ by not more than $1$ from $b, y, r$, respectively. After $n$ moves all the jars turned out to be with the caps down. Find the number of all possible values of $n$, if $n \le 2021$.