序列终止器
Sequence Terminator
题目详情
反复掷一枚公平六面骰,形成一个“当前序列”,规则如下:
- 若掷到偶数(2/4/6),把该点数加入当前序列。
- 若掷到 3 或 5,则清空当前序列,并且 3/5 不会作为新序列的起始元素(即直接丢弃)。
- 若掷到 1,则把 1 加入当前序列并立刻结束游戏。
求:游戏结束时序列长度的期望值。
例如掷出序列 34265241:第一次掷到 3 会清空;掷到 5 也会清空;最终序列为 241,长度为 3。
A fair sided die is rolled repetitively, forming a sequence of values, under the following rules: If any even value is rolled, add it to the current sequence. If a or is rolled, discard the entire sequence and don't add the or to the start of the new sequence. If a is rolled, add the to the current sequence and end the game. Find the expected length of the sequence at the end of the game.
For example if the sequence of rolls is , we would reset to an empty sequence at the first roll, reset to an empty sequence at the , and our final sequence would be , which is of length .
解析
设 为“当前序列已有长度为 ”时,最终结束序列长度的期望。
一次掷骰的转移:
- 掷到 1(概率 ):结束,最终长度为 。
- 掷到 2/4/6(概率 ):序列长度变为 。
- 掷到 3/5(概率 ):清空序列,回到 。
因此对任意 :
设解为线性形式 ,代入得 ,并且 (注意 )。
所以初始期望为