The didgits $1$ and $3$ will always be followed by the digit $2$. The digit $2$ can be followed by either $1$ or $3$. Hence the digit $2$ appears exactly five times in a ten digit number, in alternate positions.

If the first digit is $2$, then in each even position we have two choices, $1$ or $3$. This gives $2\times 2\times 2\times 2\times 2 = 32$ possibilities. Otherwise, the second digit is $2$ and in each odd position we have two choices. So again there are $32$ possibilities, making a total of $64$

*This problem is taken from the UKMT Mathematical Challenges.*

View the current weekly problem