First, let's define your state. A state is the number of coins you have currently. So if you have 2 coins, you're in state 2, whereas if you have 3 coins, you are in state 3.
The probability of rolling under any number of a d6 is given by the following:
(x-1)/6
\$\frac {x-1}{6}\$; for example, to roll under a 2, you need to roll a 1, which is a1/6
\$\frac 1 6\$ chance, or an(x-1)/6 = (2-1)/6 = 1/6
\$\frac{x-1}{6} = \frac{2-1}{6} = \frac 1 6\$ chanceThe reverse is true. To roll at least any number on a d6, it is "1
1 - Probability(rolling under that number)
;- Probability(rolling under that number)"; so to roll at least a 2, the probability is equal to not rolling under a 2. The formula is1-[(x-1)/6] = (7-x)/6
\$1-\frac{x-1}{6} = \frac{7-x}{6}\$The probability to roll 2d6 and get at least one under a certain number, is equal to the probability of rolling 2d6 and rolling both with at least that number twice. That is, the only way to "fail" your roll is if both d6's are at least that target number. The math for this is "not Pr(roll at least that number) twice", and the formula is "1
1 - Pr(roll at least that number)^2
- Pr(roll at least that number)2" which is equal to:1 - [(7-x)/6]^2
\$1 - \left(\frac{7-x}{6}\right)^2\$The probability to move from state x to state x+1 is the same as the probability of rolling 2d6 with at least one under x; put another way, the probability is the same as not rolling ata least x twice.
Let h(i,j)\$h(i,j)\$ be the expected number of steps from state i to state j.
h(2,6) = 1 + (0.694)*h(2,6) + (0.306)*h(3,6)
h(3,6) = 1 + (0.444)*h(3,6) + (0.556)*h(4,6)
h(4,6) = 1 + (0.25)*h(4,6) + (0.75)*h(5,6)
h(5,6) = 1 + (0.111)*h(5,6) + (0.889)*h(6,6)
h(6,6) = 0
\begin{align} h(2,6) &= 1 + (0.694) \times h(2,6) + (0.306) \times h(3,6) \\ h(3,6) &= 1 + (0.444) \times h(3,6) + (0.556) \times h(4,6) \\ h(4,6) &= 1 + (0.25) \times h(4,6) + (0.75) \times h(5,6) \\ h(5,6) &= 1 + (0.111) \times h(5,6) + (0.889) \times h(6,6) \\ h(6,6) &= 0 \end{align}
h(2,6) = 7.52631
h(3,6) = 4.25833
h(4,6) = 2.45833
h(5,6) = 1.125
h(6,6) = 0
\begin{align} h(2,6) &= 7.52631 \\ h(3,6) &= 4.25833 \\ h(4,6) &= 2.45833 \\ h(5,6) &= 1.125 \\ h(6,6) &= 0 \end{align}