Given $k,n\in\mathbb{N}$, $x_0\in S=\left\{1,\ldots,n\right\}$, and $ f:S\to S$, define $x_{i+1}=f^k(x_i)$ for every $i\in\{0,1,\ldots\}$ and $\tau_{f^k}(x_0)$ as the least integer $i$ such that $f^k(x_i)=x_j$ for some $j$, $j$. For the local probability $\mathsf{P}\left\{\tau_{f^k}\left(x_0\right)=z \right\}$ and for the distribution function $F_{\tau_{f^k}\left(x_0\right)}\left( z \right)$, the following estimates are obtained. If $kz$, then
\begin{gather}\notag
\mathsf{P}\left\{\tau_{f^k}\left(x_0\right){=}z \right\}>\frac 1n{\textstyle\sum\limits_{\begin{smallmatrix}
m\geq1, \\
\frac{m}{(m,k)}=z \\
\end{smallmatrix}}}{{\text{e}^{-\left( 1+\frac{m}{n} \right)\frac{{{m}^{2}}}{2n}}}}\;{+}{\textstyle\sum\limits_{\begin{smallmatrix}
m\geq1, \\
\frac{m}{(m,k)}\\
\end{smallmatrix}}}{\frac1{r+k}\text{e}^{-\left( 1+\frac{r}{n} \right)\frac{r^2}{2n}}\left( 1{-}{\left( 1{-}\frac{r+k}{n} \right)}^k \right)},\\
\notag
\mathsf{P}\left\{\tau_{f^k}\left(x_0\right)=z \right\}\frac1n{\textstyle\sum\limits_{\begin{smallmatrix}
m\geq1, \\
\frac{m}{(m,k)}=z \\
\end{smallmatrix}}}{\text{e}^{-\frac{{\left( m-1 \right)}^2}{2n}}}+{\textstyle\sum\limits_{\begin{smallmatrix}
m\geq1, \\
\frac{m}{(m,k)}\\
\end{smallmatrix}}}{\frac{1}{r}{\text{e}^{-\frac{{{\left( r-1 \right)}^{2}}}{2n}}}\left( 1-{{\left( 1-\frac{r}{n} \right)}^k} \right)},
\end{gather}
where $r=m+\left( z-\dfrac{m}{(m,k)}-1 \right)k$.
If $k^2z\leq n$, then
\begin{equation}\notag
\begin{gathered}
\frac1n\textstyle\sum\limits_{\begin{smallmatrix}
m\geq1, \\
\frac{m}{(m,k)}=z \\
\end{smallmatrix}}{\text{e}^{-\left( 1+\frac{m}{n} \right)\frac{m^2}{2n}}}+\left( 1-\dfrac{k^2z}{2n} \right)\dfrac{k}{n}\sum\limits_{\begin{smallmatrix}
m\geq1, \\
\frac{m}{(m,k)}\\
\end{smallmatrix}}{\text{e}^{-\left( 1+\frac{r}{n} \right)\frac{r^2}{2n}}} \\
\mathsf{P}\left\{\tau_{f^k}\left(x_0\right)=z \right\}\frac1n\textstyle\sum\limits_{\begin{smallmatrix}
m\geq1, \\
\frac{m}{(m,k)}=z \\
\end{smallmatrix}}{\text{e}^{-\frac{{\left( m-1 \right)}^2}{2n}}}+\dfrac{k}{n}\sum\limits_{\begin{smallmatrix}
m\geq1, \\
\frac{m}{(m,k)}\\
\end{smallmatrix}}{\text{e}^{-\frac{{\left( r-1 \right)}^2}{2n}}},
\end{gathered}
\end{equation}
which, for a prime $k$, is expressed in elementary functions and efficiently computable for used in practice values of $n$ ($2^{256}$ and more).
Also, if $ kz\leq\sqrt{n}$, then
$$\textstyle\sum\limits_{\begin{smallmatrix}
m\geq1, \\
\frac{m}{(m,k)}\leq z \\
\end{smallmatrix}}{\dfrac{r}{n}\left( 1-\dfrac{r\left( m+r \right)}{2n} \right){\text{e}^{-\left( 1+\frac{m}{n} \right)\frac{m^2}{2n}}}}{\tau_{f^k}\left(x_0\right)}(z)\sum\limits_{\begin{smallmatrix}
m\geq1, \\
\frac{m}{(m,k)}\leq z \\
\end{smallmatrix}}{\dfrac{r+1}{n}{\text{e}^{-\frac{{\left( m-1 \right)}^2}{2n}}}},$$
where $r=m+\left( z-\dfrac{m}{(m,k)} \right)k$.
In some cases, the obtained results allow to estimate the allowable period of usage of the encryption keys generated by iterative algorithms and to build criteria for quality assessment of random sequences.