Hide answer
There are two 1-digit numbers whose digits are all either 1 or 2 and who do not contain two 2s in a row (1, and 2).
There are three 2-digit numbers whose digits are all either 1 or 2 and who do not contain two 2s in a row (11, 12, and 21).
There are five 3-digit numbers whose digits are all either 1 or 2 and who do not contain two 2s in a row (111, 112, 121, 211, and 212).
There are eight 4-digit numbers whose digits are all either 1 or 2 and who do not contain two 2s in a row (1111, 1112, 1121, 1211, 1212, 2111, 2112, and 2121).
(It looks like these are the Fibonacci numbers.)
All these numbers either end in a 1, or end in 12. Therefore the \((n+1)\)-digit number can be made by appending a 1 to the end of the \(n\)-digit numbers
or appending a 12 to the end of the \((n-1)\)-digit numbers: so the next term is always the sum of the previous two terms.
Continuing the pattern, we see that there are 987 14-digit numbers are there whose digits are all either 1 or 2 and who do not contain
two 2s in a row.