Bernardo randomly picks 3 distinct numbers from the set
(1; 2; 3; 4; 5; 6; 7; 8; 9)
and arranges them in descending order to form a 3-digit number.
Silvia randomly picks 3
distinct numbers from the set
(1; 2; 3; 4; 5; 6; 7; 8) and also arranges them in descending order
to form a 3-digit number.
What is the probability that Bernardo's number is larger than
Silvia's number?
Source: AMO
Probability Bernardo's number is higher, then Silvia's number, then a tie:
0.660714285714286 .327380952380952 0.011904761904762
3108/4704 1540/4704 56/4704
37/56 55/168 1/84 done
First row in decimal approximation; second row unreduced fraction; third row reduced fraction.
DefDbl A-Z
Dim crlf$
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()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For a = 9 To 3 Step -1
For b = a - 1 To 2 Step -1
For c = b - 1 To 1 Step -1
For x = 8 To 3 Step -1
For y = x - 1 To 2 Step -1
For z = y - 1 To 1 Step -1
bernardo = 100 * a + 10 * b + c
silvia = 100 * x + 10 * y + z
If bernardo > silvia Then bct = bct + 1
If silvia > bernardo Then sct = sct + 1
If bernardo = silvia Then eqct = eqct + 1
ct = ct + 1
Next
Next
Next
Next
Next
Next
Text1.Text = Text1.Text & bct / ct & Str(sct / ct) & mform(eqct / ct, " 0.000000000000000") & crlf
Text1.Text = Text1.Text & bct & "/" & ct & " " & sct & "/" & ct & " " & eqct & "/" & ct & " " & crlf
g1 = gcd(bct, ct): g2 = gcd(sct, ct): g3 = gcd(eqct, ct)
Text1.Text = Text1.Text & bct / g1 & "/" & ct / g1 & " " & sct / g2 & "/" & ct / g2 & " " & eqct / g3 & "/" & ct / g3 & " " & " done"
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
|
Posted by Charlie
on 2015-07-17 15:11:20 |