Given an 8-digit decimal number $N$, output a new 8-digit number $f(N)$ whose first digit is the number of zeroes in $N$, the second the number of ones, ..., the seventh the number of sixes, and the eight the number of distinct digits of $N$.
The MoMath posted a puzzle that boils down to "find the (unique) fixed point of $f$", and the solution given was to start with an arbitrary seed number $N$ and apply $f$ until one finds the fixed point. They comment on why there's no reason a priori this would work, and admit they're not sure why this works. Here are my related questions:
Is there a way to see that $f$ has a unique fixed point?
Is there a way to see that applying $f$ starting from any arbitrary seed $N$, you get to the fixed point and don't get caught in a cycle when applying $f$?
They remark that no matter what seed you pick, $f$ finds its fixed point relatively quickly (say within $10$ applications of $f$). Does anyone have a reason for why one should find the fixed point so soon? I don't have a good sense for how to bound how quickly this happens.
Not yet a full answer but here are some comments, not well ordered yet.
1. Some Brute Force Looking at all possibilities, $[2,3,1,1,0,1,0,5]$ is the unique fixed point for $f$.
There are no loops, all $10^8$ possible inputs converge to to this value, in at most 8 steps. Here is an histogram of the number of iteration needed
With data : \begin{array}{c||c} \text{Nb of iterations} &\text{ Nb of inputs}\\ \hline 0&1\\ 1&3359\\ 2&1407840\\ 3&4939200\\ 4&17522400\\ 5&40745460\\ 6&25723446\\ 7&7367026\\ 8&2291268\\ \end{array} And $[0, 0, 0, 0, 7, 7, 8, 9]$ is an example of an input needing 8 iterations. Here is the "path" to the fixed point, I was hoping to use this to look for some invariant or monotone variant but I couldn't find any pattern. \begin{array}{c||c} \text{step}&\text{value}\\ \hline 0&[0, 0, 0, 0, 7, 7, 8, 9]\\ 1&[4, 0, 0, 0, 0, 0, 0, 4]\\ 2&[6, 0, 0, 0, 2, 0, 0, 2]\\ 3&[5, 0, 2, 0, 0, 0, 1, 3]\\ 4&[4, 1, 1, 1, 0, 1, 0, 5]\\ 5&[2, 4, 0, 0, 1, 1, 0, 4]\\ 6&[3, 2, 1, 0, 2, 0, 0, 4]\\ 7&[3, 1, 2, 1, 1, 0, 0, 5]\\ 8&[2, 3, 1, 1, 0, 1, 0, 5] \end{array} 2. Some first thoughts Let $N=[a_0,a_1,\ldots,a_6,a_\#]$ be a fixed point for $f$. Note that