Almost constant digits

How many 10-digit numbers containing only 1s, 2s and 3s can you write?
Exploring and noticing Working systematically Conjecturing and generalising Visualising and representing Reasoning, convincing and proving
Being curious Being resourceful Being resilient Being collaborative

Problem



How many ten-digit numbers are there which contain only the digits $1$, $2$ or $3$, and in which any pair of adjacent digits differs by $1$?

 

 

If you liked this problem, here is an NRICH task which challenges you to use similar mathematical ideas.