Find expected value of a dice experiment The following experiment is performed,


*

*Roll a dice.

*If you stick to the outcome, then the final score is the number on the dice. The experiment ends here.

*If the experiment is performed $n$ times, then you have to stick to the current outcome. The experiment ends here.

*Else you can perform the experiment again starting from step 1.


The question is to find the expected value of the score. Note that there is no probability of choosing the current outcome or doing the experiment again, its purely based on the strategy. For example, if the value of $n=2$, then if the dice outcome of first turn is $6$, then we will stick to this outcome, because we can never get better. Similarly, if the outcome of first turn is $1$, then we will always roll the dice again, because we can always get better score.
I tried the problem by constructing answers for consecutive values of n, for $n=1$ the expected score will be $3.5$, so for $n=2$ I thought that if the outcome of a turn is less than $3.5$, than roll the dice again, otherwise stick to the result. But I can't go further with this approach.
Sorry for my vague approach, but it was all I could think. 
 A: Let's suppose we are only given $1$ roll. The expected value is $3.5$.
Let's find a recursive formula for the expected value, assuming at every point in time, we attempt to maximize our expected value. Let the expected value for rolling $k$ times be $f(k)$. It is obvious that $f(k)$ is non-decreasing.
$$f(k)=\frac{1}{6}\times6+\frac{1}{6}\times\max(5, f(k-1))+\frac{1}{6}\times\max(4, f(k-1))+\frac{1}{3}\times f(k-1)$$
To find a closed form for $f$, we need to calculate enough values until $f(k)>5$, then there would likely to be a closed form.
$$f(2)=\frac{1}{6}\times6+\frac{1}{6}\times\max(5, 3.5)+\frac{1}{6}\times\max(4, 3.5)+\frac{1}{2}\times3.5=4.25>4$$
$$f(3)=\frac{1}{6}\times6+\frac{1}{6}\times\max(5, 4.25)+\frac{2}{3}\times4.25=\frac{14}{3}>4$$
$$f(4)=\frac{1}{6}\times6+\frac{1}{6}\times\max(5, \frac{14}{3})+\frac{2}{3}\times\frac{14}{3}=\frac{89}{18}>4$$
$$f(5)=\frac{1}{6}\times6+\frac{1}{6}\times\max(5, \frac{89}{18})+\frac{2}{3}\times\frac{89}{18}=\frac{277}{54}>5$$
So, for $k\geq6$, $f(k)=1+\frac{5}{6}\times f(k-1)$.
Solving the homogeneous recurrence equation, $f(k)=\frac{5}{6}\times f(k-1)$, we have the root of the characteristic equation as $\frac{5}{6}$.
Hence, $f(k)=6-A\left(\frac{5}{6}\right)^n$, for some constant $A$.
Substituting $k=5$ (base case) gives $\frac{277}{54}=f(5)=6-A\left(\frac{5}{6}\right)^5$, which gives $A=\frac{6768}{3125}$.
Hence, $f(n)=6-\frac{6768}{3125}\left(\frac{5}{6}\right)^n$ for $n\geq5$, and is one of the special cases in front if $n<5$.
