Problem

Source: 2018 Singapore Mathematical Olympiad Senior Q5

Tags: combinatorics



Starting with any $n$-tuple $R_0$, $n\ge 1$, of symbols from $A,B,C$, we define a sequence $R_0, R_1, R_2,\ldots,$ according to the following rule: If $R_j= (x_1,x_2,\ldots,x_n)$, then $R_{j+1}= (y_1,y_2,\ldots,y_n)$, where $y_i=x_i$ if $x_i=x_{i+1}$ (taking $x_{n+1}=x_1$) and $y_i$ is the symbol other than $x_i, x_{i+1}$ if $x_i\neq x_{i+1}$. Find all positive integers $n>1$ for which there exists some integer $m>0$ such that $R_m=R_0$.