The function $f$ is given by the table

| $x$ | 1 | 2 | 3 | 4 | 5 |
| :---: | :--- | :--- | :--- | :--- | :--- |
| $f(x)$ | 4 | 1 | 3 | 5 | 2 |

For example, $f(2)=1$ and $f(4)=5$. What is the value of $\underbrace{f(f(f(f(\ldots f}_{2004 \text { times }}(4) \ldots)))$ ?
(a) 1
(b) 2
(c) 3
(d) 4
(e) 5
The correct option is (d).

From the table

| $x$ | 1 | 2 | 3 | 4 | 5 |
| :---: | :--- | :--- | :--- | :--- | :--- |
| $f(x)$ | 4 | 1 | 3 | 5 | 2 |

we obtain

$$
\begin{aligned}
& f(4)=5, f(\underbrace{f(4)}_{5})=f(5)=2, f(f(\underbrace{f(4)}_{5}))=f(\underbrace{f(5)}_{2})=f(2)=1 \text{ and} \\
& \underbrace{f(f(f(f(4)}_{4 \text { times }})))=f(f(f(\underbrace{f(4)}_{5})))=f(f(\underbrace{f(5)}_{2}))=f(\underbrace{f(2)}_{1})=f(1)=4
\end{aligned}
$$

Since 2004 is a multiple of 4, it follows that $\underbrace{f(f(f(f(\ldots f}_{2004 \text { times }}(4) \ldots)))=4$. The diagram below illustrates this statement.

![](https://cdn.mathpix.com/cropped/2024_05_01_30c9a294a58a6e4b8190g-054.jpg?height=311&width=1354&top_left_y=1666&top_left_x=385)