Problem: Let $\NN$ be the set of positive integers.
Find all functions $f \colon \NN \to \NN$ that satisfy the equation
\[ f^{abc-a}(abc) + f^{abc-b}(abc) + f^{abc-c}(abc) = a + b + c \]
for all $a,b,c \ge 2$. (Here $f^k$ means $f$ applied $k$ times.)

Solution: The answer is $f(n) = n-1$ for $n \ge 3$ with $f(1)$ and $f(2)$ arbitrary;
check these work.

\begin{lemma*}
 We have $f^{t^2-t}(t^2) = t$ for all $t$.
\end{lemma*}
\begin{proof}
 We say $1 \le k \le 8$ is good if $f^{t^9-t^k}(t^9) = t^k$ for all $t$.
 First, we observe that
 \[ f^{t^9-t^3}(t^9) = t^3 \quad\text{and}\quad f^{t^3-t}(t^3) = t
   \implies f^{t^9-t}(t^9) = t.  \]
 so $k=1$ and $k=3$ are good.
 Then taking $(a,b,c) = (t,t^4,t^4)$,
 $(a,b,c) = (t^2, t^3, t^4)$
 gives that $k = 4$ and $k = 2$ are good, respectively.
 % $(a,b,c) = (t,t^3,t^5)$,  gives $5$ good
% Similarly, $(a,b,c) = (t,t^2,t^6)$ and $(a,b,c) = (t,t,t^7)$
% gives $6$ and $7$ are good.
 The lemma follows from this $k=1$ and $k=2$ being good.
\end{proof}

Now, letting $t = abc$ we combine
\begin{align*}
 f^{t-a}(t) + f^{t-b}(t) + f^{t-c}(t) &= a+b+c \\
 f^{t^2-ab} (t^2) + f^{t^2-t} (t^2) + f^{t^2-c} (t^2) &= ab + t + c \\
 \implies \left[ f^{t-a}(t) - a \right]
 + \left[ f^{t-b}(t) - b \right]
 &=
 \left[ f^{t-ab}(t) - ab \right]
\end{align*}
by subtracting and applying the lemma repeatedly.
In other words, we have proven the second lemma:
\begin{lemma*}
  Let $t$ be fixed, and define $g_t(n) = f^{t-n}(t) - n$ for $n < t$.
  If $a,b \ge 2$ and $ab \mid t$, $ab < t$,  then $g_t(a) + g_t(b) = g_t(ab)$.
\end{lemma*}

Now let $a,b \ge 2$ be arbitrary, and let $p > q > \max\{a,b\}$ be primes.
Suppose $s = a^p b^q$ and $t = s^2$; then
\[ p g_t(a) + q g_t(b)
  = g_t\left( a^p b^q \right) = g_t(s)
  = f^{s^2-s}(s^2) - s = 0.  \]
Now \[ q \mid g_t(a) > -a
  \quad\text{and}\quad p \mid g_t(b) > -b
  \implies g_t(a) = g_t(b) = 0.  \]
and so we conclude $f^{t-a}(t) = a$ and $f^{t-b}(t) = b$ for $a,b \ge 2$.

In particular, if $a = n$ and $b = n+1$
then we deduce $f(n+1) = n$ for all $n \ge 2$, as desired.

\begin{remark*}
  If you let $c = (ab)^2$ after the first lemma, you recover the $2$-variable version!
\end{remark*}