Problem

Source: 2023 Taiwan Mathematics Olympiad

Tags: Taiwan, combinatorics



Let $n$ and $m$ be positive integers. The daycare nanny uses $n \times m$ square floor mats to construct an $n \times m$ rectangular area, with a baby on each of the mats. Each baby initially faces toward one side of the rectangle. When the nanny claps, all babies crawl one mat forward in the direction it is facing at, and then turn 90 degrees clockwise. If a baby crawls outside of the rectangle, it cries. If two babies simultaneously crawl onto the same mat, they bump into each other and cry. Suppose that it is possible for the nanny to arrange the initial direction of each baby so that, no matter how many times she claps, no baby would cry. Find all possible values of $n$ and $m$. Proposed by Chu-Lan Kao