I am solving a computer programming problem.
I wonder if an easy mathematical solution to the following problem exists or not.
Suppose we throw a fair die sufficiently number of times.
Let $a_i$ be the outcome of $i$-th roll.
What is the expected number of $\min\{i \mid a_i\geq a_{i+1}\}$?
My attempt is here:
The probability of $\min\{i \mid a_i\geq a_{i+1}\}=1$ is $\frac{1}{6}\frac{6}{6}+\frac{1}{6}\frac{5}{6}+\frac{1}{6}\frac{4}{6}+\frac{1}{6}\frac{3}{6}+\frac{1}{6}\frac{2}{6}+\frac{1}{6}\frac{1}{6}$.
Let $X=\min\{i \mid a_i\geq a_{i+1}\}$
Then $P(X\ > i)=P(a_1 < a_2, a_2 < a_3 , ..., a_i < a_{i+1})$
Now, if we throw a $6-$faces die $k$ times, there are $\binom{6}{k}$ possible strictly increasing sequences.
Hence the above probability is
$$P(X\ > i) = \frac{\binom{6}{i+1}}{6^{i+1}}$$
for $i =1,2 \cdots 5$. And the expected value is
$$\begin{align} E[X] &= \sum_{i=0}^\infty P(X\ > i) \\ &= 1 + \sum_{i=1}^5 \frac{\binom{6}{i+1}}{6^{i+1}} \\ &=\sum_{k=0}^6 \binom{6}{k}{(1/6)^{k}} -1\\ &= \left(1 + \frac{1}{6}\right)^6-1\\ &=1.5216\cdots\end{align}$$
where we've used the Binomial theorem.