Suppose I have positive integers $a$ and $n$. I want to find the number of times $f(x)=x-\lfloor\frac{x}{n}\rfloor$ could be composed on itself with initial argument $a$ until a number less than $n$ is reached. In other words, the minimum $k$ such that $f^k(a)<n$.
I tried approximating repeated calls of $f(x)$ by considering the exponential function $g(x)=a(1-\frac{1}{n})^x$, but this tends to underestimate $k$. I also noticed that in base $n$, $f(a)$ is equivalent to subtracting $a$ by $a$ with the last digit cut off, but this observation doesn't seem to get anywhere either. The function doesn't seem too complicated, so it seems like there should be a solution.
The following will be approximate, ignoring remainders when we divide $n$ by small numbers and $\pm 1$ to get strictly below a multiple of $n$.
Imagine $a$ is a multiple of $n$. If $a=2n$ each step downward is $1$, so it takes $n$ steps to get below $n$. If $a=3n$ each of the first $\frac n2$ steps is $2$, so it takes $\frac n2$ steps to get to $2n$ when the steps become $1$. It takes another $n$ steps to get below $n$, so it takes $n(1+\frac 12)$ steps from $a=3n$. Similarly from $a=4n$ it will take $n(1+\frac 12 + \frac 13)$ steps and from $a=kn$ it will take $nH_{k-1}$ steps where $H_{k-1}$ is the $k-1^{\text {st}}$ harmonic number, approximately $\log (k-1)+\gamma$. You can interpolate for cases where $a$ is not a multiple of $n$. This approximation breaks down as $a$ approaches $n^2$ because the changes in the subtraction are large from one step to the next. As an example, for $n=100, a=1000$ it takes $282$ steps compared to $288$ by the formula. However for $n=100, a=10000$ it takes $516$ steps instead of $461$ from the formula.