<s>[INST] Roll a fair 6 faces die. Stop if the sum of the previous rolls is a multiple of 3. What is the expected time to stop. Given there is a regular fair die, roll the die and stop if the sum of all previous rolls is a multiple of 3. What is the expected number of rolls?
Let $X$ denote the number of rolls until the event {the sum of all previous rolls is a multiple of 3} happens.
For $X = 1$, the rolls must be 3 or 6.
For $X = 2$, the rolls must be one of $\{(1,2), (2,1), (1,5), (5,1), (2,4), (4,2), (4,5), (5,4)  \}$
For $X = 3$, the rolls must be one of $\{(1,1,1), (1,3,2),(1,3,5),(1,4,1), \ldots\}$
From the above enumeration, the pattern was not clear to me. I suppose there must be some "patterns" to simplify the computation.
 [/INST] Let $f(x)$ denote the expected number of runs till we get remainder $0$ with $x$ denoting the current remainder mod $3$.
Note that each remainder has $\frac{1}{3}$ chance of occurring.
$$f(1) = \frac{1}{3}(1 + f(2)) + \frac{1}{3}(f(1) + 1) + \frac{1}{3}(1)$$
$$f(2) = \frac{1}{3}(1 + f(1)) + \frac{1}{3}(f(2) + 1) + \frac{1}{3}(1)$$
Note that in case of $f(1)$, if we get remainder $2$ on the roll (numbers $2$ and $5$), we end the process, so we count only $1$ roll.
Similarly, for $f(2)$.
We get $f(1) = f(2)$. Solving, we get $f(1) = f(2) = 3$.
Let us now iterate on the value of the first die roll. (Initial remainder is $0$)
$$ans = \frac{1}{3}(f(2) + 1) + \frac{1}{3}(f(1) + 1) + \frac{1}{3}(1)$$
$$ans = 3$$
</s>