Problem

Source: 2019 Chile National Olympiad level 2 p1

Tags: combinatorics



A square of $3 \times 3$ is subdivided into 9 small squares of $1 \times 1$. It is desired to distribute the nine digits $1, 2, . . . , 9$ in each small square of $1 \times 1$, a number in each small square. Find the number of different distributions that can be formed in such a way that the difference of the digits in cells that share a side in common is less than or equal to three. Two distributions are distinct even if they differ by rotation and/or reflection.