描述 Description

扔一个k面的骰子,扔出连续n个任意数字所需的平均次数?

例如扔一个六面的骰子,平均扔多少次能连续扔出三个相同的数字?

Suppose that independent trials, each of which is equally likely to have any of 6 possible outcomes, are performed until the same outcome occurs 3 consecutive times. If N denotes the number of trials. What is E[N]?

[问题描述-知乎]

分析 Analysis

1 扔一个六面的骰子,平均扔多少次能连续扔出n个相同的数字?

表示连续出现 个任意数字所需实验次数, 表示连续出现 个任意数字到连续出现 个任意数字所需实验次数。有

对上式取期望值有:

,

其中

.

化简式子得差分方程:

结合边界条件 ,解得

Note: 根据差分方程 ,待定系数[数列递推公式求通项公式的方法]得

xn + m= 6 (x_n-1 + m) m = 1/5

=> x_n + 1/5= 6^n-1 * (x_1 + 1/5)

=> xn =

更快可以使用特征方程法[特征方程法]

2 扔一个六面的骰子,平均扔多少次能连续扔出三个相同的数字?

3 一般地,扔一个k面的骰子,扔出连续n个任意数字所需的平均次数?

代码 Code

模拟

Sample[a_, b_, c_, Count_] := Block[{},
   If[And[a == b, b == c], Return[Count], 
    Sample[b, c, RandomChoice[{1, 2, 3, 4, 5, 6}], Count + 1]]
   ];
Mean[Table[
   Sample[RandomChoice[{1, 2, 3, 4, 5, 6}], 
    RandomChoice[{1, 2, 3, 4, 5, 6}], 
    RandomChoice[{1, 2, 3, 4, 5, 6}], 3], {i, 1, 20000}]] // N

results matching ""

    No results matching ""