14. (FRG 1) How many words with $n$ digits can be formed from the alphabet $\{0,1,2,3,4\}$, if neighboring digits must differ by exactly one?
14. Let $x_{n}$ be the total number of counted words of length $n$, and $y_{n}, z_{n}, u_{n}$, $z_{n}, y_{n}$ the numbers of counted words of length $n$ starting with $0,1,2,3,4$. respectively (indeed, by symmetry, words starting with 0 are equally numbered as those starting with 4 , etc.). We have the clear relations
(1) $y_{n}=z_{n-1}$;
(2) $z_{n}=u_{n-1}+u_{n-1}$;
(3) $u_{n}=2 z_{n-1}$;
(4) $x_{n}=2 y_{n}+2 z_{n}+u_{n}$.
From (1), (2), and (3) we get $z_{n}=z_{n-2}+2 z_{n-2}=3 z_{n-2}$, with $z_{1}=1$, $z_{2}=2$, which gives
$$
z_{2 n}=2 \cdot 3^{n-1}, \quad z_{2 n+1}=3^{n} \text {. }
$$

Then (1), (3), and (4) obviously imply
$$
\begin{array}{ll}
y_{2 n}=3^{n-1}, & y_{2 n+1}=2 \cdot 3^{n-1} \\
u_{2 n}=2 \cdot 3^{n-1}, & y_{2 n+1}=4 \cdot 3^{n-1} \\
x_{2 n}=8 \cdot 3^{n-1}, & x_{2 n+1}=14 \cdot 3^{n-1}
\end{array}
$$
with the initial number $x_{1}=5$.