Let $S$ be a finite set of $|S|=n$ elements and $F$ be the set of all functions $f:S\rightarrow S$.
It's easy to demonstrate that the integer sequence $\{c_i\} = |{\rm Im}(f^i)|$:
- is non increasing;
- consists of a strictly decreasing sequence up to a certain $n'$, after which becomes constant;
- $n' \leq n$ where $n'$, as defined above, is the maximum number for which $i \leq n' \implies \{c_i\} = |{\rm Im}(f^{i})|$ is strictly decreasing;
Quick demonstration:
$\forall i \geq 1, {\rm Im}(f^i) = {\rm Im}(f|_{{\rm Im}(f^{i-1})})$
while $f^0$ is identity and $f|_A$ means "$f$ restricted to $A$".
Obviously, either
$\left|\textrm{Im}(f|_{\textrm{Im}(f^{i-1})})\right| < |\textrm{Im}(f^{i-1})|$
or
$\left|\textrm{Im}(f|_{\textrm{Im}(f^{i-1})})\right| = |\textrm{Im}(f^{i-1})|$
which demonstrates 1. 2 derives from the fact $|\textrm{Im}(f|_{\textrm{Im}(f^{i-1})})| = |\textrm{Im}(f^{i-1})|$ means that $f|_{\textrm{Im}(f^{i-1})}$ is a permutation, and permutations are closed with respect of composition. 3 follows from observing the simple example in which $S = \{1, 2, \cdots, n', \cdots, n\}$ and $f(x) = x+1$, for $x \in \{1, \cdots, n-1\}$ and $f(n) = n'$. In this case, we have $\{c_i\} = n-i$ for $1 \leq i < n$ and $\{c_i\} = 1$ for $n \leq i$, and that shows that $n'$ can have any value between $0$ and $n$.
So, in summary, and roughly speaking, 'if you iterate a function over a finite set enough times, you end up with fixed-sized set'. My question is: when size $|S| = n$ of the initial set tends to infinity, and $f$ is randomly chosen from $F$, what is the expectation of the ratio of the sizes of the set resulting of such iterations and the initial set? Namely what is $\lim_{n \to \infty}E[|\textrm{Im}(f^n(S))|/n]$
There is an immediate application to this question which are the considerations about loss of entropy due to birthday paradox in hashes.