Example 14 Let $S$ be the unit circle in the complex plane (i.e., the set of complex numbers with modulus 1), and let $f$ be a mapping from $S$ to $S$, defined by $f_{1}(z)=f(z), f_{k+1}(z)=f\left(f_{k}(z)\right), k=1,2,3, \cdots$. If $c \in S$ and a positive integer $n$ exist such that $f_{n}(c)=c$, and $f_{k}(c) \neq c\left(k \in \mathbf{N}^{+}, 1 \leqslant k \leqslant n-1\right)$, we call $c$ an $n-$periodic point of $f$.
Let $m$ be a positive integer greater than 1, and $f$ is defined as follows:
$$
f(z)=z^{m}(z \in S) \text {. }
$$

Calculate the number of 1989-periodic points of $f$.
(1989 4th CMO Problem)
Given that $f_{1}(z)=f(z)=z^{m}$, it is easy to prove by induction that $f_{n}(z)=z^{m^{n}}, n=1,2, \cdots$. Let $A_{n}=\{z \in S \mid z$ is an $n-$ periodic point of $f\}$ and $B_{n}=\left\{z \in S \mid f_{n}(z)=z\right\}$. The problem then reduces to finding $\left|A_{1989}\right|$. Clearly, $B_{n} \supseteq A_{n}$, and since $z \in S$ implies $z \neq 0$, the equation $f_{n}(z)=z$ is equivalent to $z^{m^{n}-1}=1$, meaning $z$ is a $(m^{n}-1)$-th root of unity, of which there are $m^{n}-1$. Therefore, $\left|B_{n}\right|=m^{n}-1$.

Next, we prove that the set of fixed points of $f_{n}$, $B_{n}$, and the set of $n$-periodic points of $f$, $A_{n}$, have the following properties: Let $k, n$ be positive integers,
(1) If $k \mid n$ then $B_{k} \subseteq B_{n}$;
(2) $B_{k} \cap B_{n}=B_{(k, n)}$, where $(k, n)$ is the greatest common divisor of $k$ and $n$;
(3) $c \in B_{n} \backslash A_{n} \Leftrightarrow$ there exists a positive integer $k<n$ such that $k \mid n$ and $c \in B_{k}$.
In fact,
(1.) Suppose $n=k q$ (where $q$ is a positive integer). If $c \in B_{k}$, i.e., $f_{k}(c)=c$, then $f_{n}(c)=f_{b q}(c)=$ $\underbrace{f_{k}\left(f_{k}\left(\cdots f_{k}(c)\right)\right)}_{q \uparrow f_{k}}=c$, i.e., $c \in B_{n}$, hence $B_{k} \subseteq B_{n}$.
(2) By (1), $B_{(k, n)} \subseteq B_{k}, B_{(k, n)} \subseteq B_{n}$, so $B_{(k, n)} \subseteq B_{k} \cap B_{n}$. Conversely, suppose $c \in B_{k} \cap B_{n}$, i.e., $f_{k}(c)=c, f_{n}(c)=c$. Without loss of generality, assume $k<n$, then $f_{n-k}(c)=f_{n-k}\left(f_{k}(c)\right)=f_{n}(c)=c$, and by the Euclidean algorithm, we get $f_{(k, n)}(c)=c$, i.e., $c \in B_{(k, n)}$, so $B_{k} \cap B_{n} \subseteq B_{(k, n)}$, thus $B_{k} \cap B_{n}=$ $B_{(k, n)}$.
(3) By (1) and the definition of $n$-periodic points of $f$, the sufficiency is clear. Now we prove the necessity. Suppose $c \in B_{n} \backslash A_{n}$, i.e., $f_{n}(c)=c$ and there exists $l<n$ such that $f_{l}(c)=c$. Let the smallest positive integer for which $f_{l}(c)=c$ is $k$, clearly $k<n$. We prove that $k \mid n$. Otherwise, there exist positive integers $q, r$ such that $n=q k+r(0<r<k)$. By (1), $f_{k q}(c)=c$, thus $f_{r}(c)=f_{r}\left(f_{k q}(c)\right)=f_{k q+r}(c)=f_{n}(c)=c$, which contradicts the minimality of $k$.

Since $1989=3^{2} \cdot 13 \cdot 17$, if a positive integer $k \mid 1989(k<1989)$, then $k$ must be a divisor of at least one of $3 \cdot 13 \cdot 7,3^{2} \cdot 17$, $3^{2} \cdot 13$ (i.e., $663,153,117$). By property (1), $B_{k} \subseteq B_{663} \cup B_{153} \cup B_{117}$. Therefore, by property (3),
$$
A_{1989}=B_{1989} \backslash\left(\underset{\substack{k \leqslant 11989 \\ 1 \leqslant k \leqslant 999}}{ } B_{k}\right)=B_{1989} \backslash\left(B_{663} \cup B_{153} \cup B_{117}\right) .
$$

By the principle of inclusion-exclusion and property (2), the number of 1989-periodic points of $f$ is
$$
\begin{aligned}
& \left|A_{1999}\right|=\left|B_{1989}\right|-\left|B_{663}\right|-\left|B_{153}\right|-\left|B_{117}\right|+\left|B_{663} \cap B_{153}\right|+ \\
& \left|B_{663} \cap B_{117}\right|+\left|B_{663} \cap B_{153} \cap B_{117}\right| \\
= & \left(m^{1999}-1\right)-\left(m^{663}-1\right)-\left(m^{153}-1\right)-\left(m^{117}-1\right)+\left(m^{51}-1\right)+ \\
& \left(m^{39}-1\right)+\left(m^{9}-1\right)-\left(m^{3}-1\right) \\
= & m^{1989}-m^{663}-m^{153}-m^{117}+m^{51}+m^{39}+m^{9}-m^{3} .
\end{aligned}
$$