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?
To test out the possibility that the expected number of rolls is just the reciprocal of the probability of getting the set on the first set of 8, incremented by the 7 rolls before a hit is possible, I started with a simulation of a simpler case, where the digits are equally likely. The expectation in the case this hypothesis is true, in the simplified case, would be 8^8 / 8! + 7 ~= 423. However, presumably because of the non-independence (the overlapping) of successive sets of 8, the simulation shows the average number of rolls to get a hit is around 490. Again, this is the simpler case, where the digits are all equally likely.
Three iterations of 10,000 trials each, show an average number of rolls as:
492.1468 done
488.0111 done
488.6338 done
DefDbl A-Z
Dim crlf$
Private Sub Command1_Click()
Form_Load
End Sub
Private Sub Form_Load()
Form1.Visible = True
' Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
digs$ = "12345678"
Randomize Timer
tCt = 0: tTr = 0
For trial = 1 To 10000
had$ = "": good = 0
Do
DoEvents
r = Int(Rnd(1) * 8 + 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
|
Posted by Charlie
on 2016-09-08 12:10:15 |