Under French law, the Beaujolais Nouveau
( wine ) is released at
12:01 A.M. on the third Thursday in November every year.
Last year, prior to the above date 11 wine amateurs deposited 12 small-size barrels at their merchant’s store (A,B,C,D,E,F,G - 7 liters each; S,T,U - 5 liters each and V two barrels: one 7 liters and one 5 liters).
When the wine arrived 70 liters were poured in the above barrels so that each barrel got an integer number of liters. The Customers were billed accordingly.
If every possible distribution of wine among the 12 barrels is equally likely, what is the possibility that V(ictor) had to pay for 11 liters of wine?
DefDbl A-Z
Dim crlf$, capacity(12), emptyLeft, filledAmt(12), ct, hitCt(12, 12)
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
Private Sub Form_Load()
ChDir "C:\Program Files (x86)\DevStudio\VB\projects\flooble"
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
DoEvents
Open "beaujolais nouveau day.txt" For Output As #2
emptyLeft = 6
capacity(1) = 7
capacity(2) = 7
capacity(3) = 7
capacity(4) = 7
capacity(5) = 7
capacity(6) = 7
capacity(7) = 7
capacity(8) = 5
capacity(9) = 5
capacity(10) = 5
capacity(11) = 7
capacity(12) = 5
consider 1
Close 2
For i = 1 To 11
Text1.Text = Text1.Text & crlf & i & crlf
For j = 0 To 12
If hitCt(i, j) > 0 Then
g = gcd(ct, hitCt(i, j))
Text1.Text = Text1.Text & mform(j, "#0") & " "
DoEvents
Text1.Text = Text1.Text & mform(hitCt(i, j), "#####") & Str(ct) & mform(hitCt(i, j) / ct, "#0.00000000") & mform(hitCt(i, j) / g, "#####") & Str(ct / g) & crlf
DoEvents
End If
Next
Next
Text1.Text = Text1.Text & crlf & "done"
End Sub
Sub consider(wh)
lowlim = capacity(wh) - emptyLeft
If lowlim < 0 Then lowlim = 0
highlim = capacity(wh)
For newamt = lowlim To highlim
emptyNow = capacity(wh) - newamt
emptyLeft = emptyLeft - emptyNow
If wh = 2 Then Text2.Text = filledAmt(1) & Str(filledAmt(2)): DoEvents
filledAmt(wh) = newamt
If wh = 12 Then
If emptyLeft = 0 Then
For i = 1 To 12
Print #2, filledAmt(i);
If i < 11 Then hitCt(i, filledAmt(i)) = hitCt(i, filledAmt(i)) + 1
Next
v = filledAmt(11) + filledAmt(12)
hitCt(11, v) = hitCt(11, v) + 1
ct = ct + 1
If filledAmt(11) + filledAmt(12) = 11 Then
Print #2, " *"
Else
Print #2,
End If
End If
Else
consider wh + 1
End If
emptyLeft = emptyLeft + emptyNow
Next
End Sub
Function gcd(a, b)
x = a: y = b
Do
q = Int(x / y)
z = x - q * y
x = y: y = z
Loop Until z = 0
gcd = x
End Function
finds these statistics:
4004 12372 0.32363401 1001 3093
That is, out of the 12372 possible ways the barrels could have been filled, 4004 had a total of 11 liters in Victor's two barrels. That makes for a probability of 1001/3093 ~= .323634012285807.
For amateurs 1 through 11, all the statistics are:
1
occur. out probability reduced
of fraction
1 1 12372 0.00008083 1 12372
2 11 12372 0.00088910 11 12372
3 66 12372 0.00533463 11 2062
4 286 12372 0.02311672 143 6186
5 1001 12372 0.08090850 1001 12372
6 3003 12372 0.24272551 1001 4124
7 8004 12372 0.64694471 667 1031
2
1 1 12372 0.00008083 1 12372
2 11 12372 0.00088910 11 12372
3 66 12372 0.00533463 11 2062
4 286 12372 0.02311672 143 6186
5 1001 12372 0.08090850 1001 12372
6 3003 12372 0.24272551 1001 4124
7 8004 12372 0.64694471 667 1031
3
1 1 12372 0.00008083 1 12372
2 11 12372 0.00088910 11 12372
3 66 12372 0.00533463 11 2062
4 286 12372 0.02311672 143 6186
5 1001 12372 0.08090850 1001 12372
6 3003 12372 0.24272551 1001 4124
7 8004 12372 0.64694471 667 1031
4
1 1 12372 0.00008083 1 12372
2 11 12372 0.00088910 11 12372
3 66 12372 0.00533463 11 2062
4 286 12372 0.02311672 143 6186
5 1001 12372 0.08090850 1001 12372
6 3003 12372 0.24272551 1001 4124
7 8004 12372 0.64694471 667 1031
5
1 1 12372 0.00008083 1 12372
2 11 12372 0.00088910 11 12372
3 66 12372 0.00533463 11 2062
4 286 12372 0.02311672 143 6186
5 1001 12372 0.08090850 1001 12372
6 3003 12372 0.24272551 1001 4124
7 8004 12372 0.64694471 667 1031
6
1 1 12372 0.00008083 1 12372
2 11 12372 0.00088910 11 12372
3 66 12372 0.00533463 11 2062
4 286 12372 0.02311672 143 6186
5 1001 12372 0.08090850 1001 12372
6 3003 12372 0.24272551 1001 4124
7 8004 12372 0.64694471 667 1031
7
1 1 12372 0.00008083 1 12372
2 11 12372 0.00088910 11 12372
3 66 12372 0.00533463 11 2062
4 286 12372 0.02311672 143 6186
5 1001 12372 0.08090850 1001 12372
6 3003 12372 0.24272551 1001 4124
7 8004 12372 0.64694471 667 1031
8
0 11 12372 0.00088910 11 12372
1 66 12372 0.00533463 11 2062
2 286 12372 0.02311672 143 6186
3 1001 12372 0.08090850 1001 12372
4 3003 12372 0.24272551 1001 4124
5 8005 12372 0.64702554 8005 12372
9
0 11 12372 0.00088910 11 12372
1 66 12372 0.00533463 11 2062
2 286 12372 0.02311672 143 6186
3 1001 12372 0.08090850 1001 12372
4 3003 12372 0.24272551 1001 4124
5 8005 12372 0.64702554 8005 12372
10
0 11 12372 0.00088910 11 12372
1 66 12372 0.00533463 11 2062
2 286 12372 0.02311672 143 6186
3 1001 12372 0.08090850 1001 12372
4 3003 12372 0.24272551 1001 4124
5 8005 12372 0.64702554 8005 12372
11 (This is Victor)
6 6 12372 0.00048497 1 2062
7 60 12372 0.00484966 5 1031
8 275 12372 0.02222761 275 12372
9 880 12372 0.07112835 220 3093
10 2145 12372 0.17337536 715 4124
11 4004 12372 0.32363401 1001 3093
12 5002 12372 0.40430003 2501 6186
A sampling of the possibilities is:
A B C D E F G S T U V V
1 7 7 7 7 7 7 5 5 5 7 5
2 6 7 7 7 7 7 5 5 5 7 5
2 7 6 7 7 7 7 5 5 5 7 5
2 7 7 6 7 7 7 5 5 5 7 5
2 7 7 7 6 7 7 5 5 5 7 5
2 7 7 7 7 6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