The expected number is 7.114230.... The probability distribution is
1 0.0900535
2 0.0900535
3 0.0888840
4 0.0865450
5 0.0830832
6 0.0785922
7 0.0732092
8 0.0671084
9 0.0604921
10 0.0535787
11 0.0465902
12 0.0397387
13 0.0332144
14 0.0271754
15 0.0217403
16 0.0169846
17 0.0129407
18 0.0096012
19 0.0069254
20 0.0048478
21 0.0032866
22 0.0021533
23 0.0013600
24 0.0008257
25 0.0004804
26 0.0002669
27 0.0001410
28 0.0000705
29 0.0000332
30 0.0000146
31 0.0000060
32 0.0000022
33 0.0000008
34 0.0000002
35 0.0000001
36 0.0000000
37 0.0000000
38 0.0000000
39 0.0000000
40 0.0000000
The problem was presented by Paul J. Nahin in his book, Digital Dice, 2008, Princeton University Press, as a puzzle about a pipe smoker with two books of matches with 40 matches in each book.
I highly recommend the book to anyone interested in probability puzzles, as well as his Duelling Idiots and Other Probability Puzzlers.
My figures were calculated by:
DefDbl A-Z
Dim crlf$, pState(80, 40, 40), remain(40)
Private Sub Form_Load()
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
pState(0, 40, 40) = 1
For t = 0 To 79
For a = 0 To 40
For b = 0 To 40
p = pState(t, a, b)
If p > 0 Then
If a > 0 And b > 0 Then
pState(t + 1, a - 1, b) = pState(t + 1, a - 1, b) + p / 2
pState(t + 1, a, b - 1) = pState(t + 1, a, b - 1) + p / 2
If b - 1 = 0 Then remain(a) = remain(a) + p / 2
If a - 1 = 0 Then remain(b) = remain(b) + p / 2
ElseIf a > 0 Then
pState(t + 1, a - 1, b) = pState(t + 1, a - 1, b) + p
ElseIf b > 0 Then
pState(t + 1, a, b - 1) = pState(t + 1, a, b - 1) + p
End If
End If
Next
Next
Next
For i = 0 To 40
Text1.Text = Text1.Text & mform(i, "#0") & mform(remain(i), " 0.0000000") & crlf
tot = tot + remain(i)
expVal = expVal + i * remain(i)
Next
Text1.Text = Text1.Text & crlf & tot & " " & expVal & crlf
End Sub
Function mform$(x, t$)
a$ = Format$(x, t$)
If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
mform$ = a$
End Function
|