Let \[f(n) =
\begin{cases}
n^2-1 & \text{ if }n < 4,
\\ 3n-2 & \text{ if }n \geq 4.
\end{cases}
\]Find $f(f(f(2)))$.
I notice that this is a piecewise function, so I need to be careful about which formula to use for each value of $n$. I start by evaluating the innermost function, $f(2)$. Since $2 < 4$, I use the first formula: $f(2) = 2^2 - 1 = 3$. Next, I evaluate $f(f(2)) = f(3)$. Again, $3 < 4$, so I use the first formula: $f(3) = 3^2 - 1 = 8$. Finally, I evaluate $f(f(f(2))) = f(8)$. This time, $8 \geq 4$, so I use the second formula: $f(8) = 3(8) - 2 = 22$.

