Example 22 (Problem 21 of the 1989 Canadian Mathematics Competition) Define $\left\{a_{n}\right\}_{n=1}^{\infty}$ as follows: $a_{1}=1989^{1989}$, and $a_{n} (n>1)$ is equal to the sum of the digits of $a_{n-1}$, what is $a_{5}$?
Since $a_{1}=1989^{1989}<10000^{1989}$,
and $10000^{1989}$ has $4 \cdot 1989+1=7957$ digits.
Therefore, $a_{1}$ has no more than 7957 digits.
By the problem, $a_{2}$ is the sum of the digits of $a_{1}$, then
$$
a_{2}<10 \cdot 8000=80000 \text {. }
$$

So $a_{2}$ is at most a 5-digit number, hence
$$
a_{3} \leqslant 7+4 \cdot 9=43, a_{4} \leqslant 4+9=13 \text {. }
$$

Thus $a_{5}$ is a single-digit number.
Since any positive integer is divisible by 9 if and only if the sum of its digits is divisible by 9.
Since $9 \mid 1+9+8+9=27$, then $9 \mid 1989^{1989}$.
Therefore, $9 \mid a_{5}$.
That is, $a_{5}=0$ or 9.
$a_{5}=0$ is obviously impossible, so $a_{5}=9$.