Consider an eight-sided die numbered 1 to 8 which is loaded in such a way that the probability of each face turning up is proportional to the number of dots on that face. For example, a six is
three times as probable as a two.
The die is rolled until a run of 8 different faces appears. For example, one might roll the sequence 6565742726486467483472516 with only the last eight rolls all distinct.
(i) What is the expected number of rolls for the above event?
(ii) How will the answer change if the last 8 rolls was required to produce 12345432 (strictly in this order?
A simulation of the problem presented (part i) finds an average of about 2000 rolls to be necessary, using the non-uniform distribution:
DefDbl A-Z
Dim crlf$, denom(36)
Private Sub Command1_Click()
Form_Load
End Sub
Private Sub Form_Load()
Form1.Visible = True
' Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
digs$ = "12345678"
For i = 1 To 8
For j = 1 To i
subs = subs + 1
denom(subs) = i
' Text1.Text = Text1.Text & subs & Str(denom(subs)) & crlf
Next
Next
Randomize Timer
tCt = 0: tTr = 0
For trial = 1 To 1000
had$ = "": good = 0
Do
DoEvents
r = denom(Int(Rnd(1) * 36 + 1))
had = had + LTrim(Str(r))
If Len(had) >= 8 Then
good = 1
rt$ = Right(had, 8)
For i = 1 To 8
If InStr(rt$, Mid(digs, i, 1)) = 0 Then good = 0: Exit For
Next
End If
Loop Until good
tCt = tCt + Len(had): tTr = tTr + 1
Next
Text1.Text = Text1.Text & crlf & tCt / tTr & " done"
End Sub
Averages of 1000 trials each:
1936.804 done
2131.657 done
2016.968 done
2138.565 done
1988.753 done
2007.053 done
1965.55 done
1980.193 done
1996.846 done
2051.373 done
The average of these, representing 10,000 trials, is 2021.3762.
|
Posted by Charlie
on 2016-09-08 13:11:57 |