6・17 Function $f$ is defined on the set of integers and satisfies
$$f(n)=\left\{\begin{array}{l}
n-3, \quad \text { when } n \geqslant 1000 ; \\
f(f(n+5)), \text { when } n<1000 .
\end{array}\right.$$

Find $f(84)$.
[Solution] Since $84+5 \times 184=1004>1000$, we have
$$\begin{aligned}
f(84) & =\underbrace{f \cdots f}_{185 \uparrow}(1004)=\underbrace{f \cdots f}_{184 \uparrow}(1001) \\
& =\underbrace{f \cdots f}_{183 \uparrow}(998)=\underbrace{f \cdots f}_{184 \uparrow}(1003) \\
& =\underbrace{f \cdots f}_{183 \uparrow}(1000)=\underbrace{f \cdots f}_{182 \uparrow}(997) \\
& =\underbrace{f \cdots f}(1002)=\underbrace{f \cdots f}(999) \\
& =\underbrace{f \cdots f}_{183 \uparrow}(1004)=\cdots \\
& =f f f(1004)=\cdots \\
& =f(1000)=997 .
\end{aligned}$$

Extension We can use mathematical induction to prove a stronger conclusion:
$$f(n)\left\{\begin{array}{l}
997, \text { when } n \text { is an even number less than } 1000, \\
998, \text { when } n \text { is an odd number less than } 1000.
\end{array}\right.$$