There are seven friends having different nicknames: Red, Orange, Yellow, Green, Blue, Indigo and Violet. There are seven chairs colored: red, orange, yellow, green, blue, indigo and violet.
- No friend sat on a chair having a color that matches his name, and:
- Red did not sit in the violet chair, and:
- Orange did not sit in the indigo chair.
Determine the probability that:
(i) (Red, Orange, Yellow) = (blue chair, green chair, red chair)
(ii) Yellow did not sit on the blue chair and Green did not sit on the yellow chair.
(iii) Yellow sat on the green chair given that Green did not sit on the blue chair.
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()
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
DoEvents
a$ = "roygbiv": h$ = a$
Do
good = 1
For i = 1 To 7
If Mid(a$, i, 1) = Mid(h$, i, 1) Then good = 0: Exit For
Next
If Right(a$, 1) = "r" Then good = 0
If Mid(a$, 6, 1) = "o" Then good = 0
If good Then
goodct = goodct + 1
If Left(a$, 1) = "y" And Mid(a$, 4, 2) = "or" Then ct1 = ct1 + 1
If Mid(a$, 5, 1) <> "y" And Mid(a$, 3, 1) <> "g" Then ct2 = ct2 + 1
If Mid(a$, 5, 1) <> "g" Then
greenNotInBlue = greenNotInBlue + 1
If Mid(a$, 4, 1) = "y" Then ct3 = ct3 + 1
End If
End If
permute a$
Loop Until a$ = h$
Text1.Text = Text1.Text & ct1 & "/" & goodct & "=" & mform(ct1 / goodct, "#.00000000000") & crlf
Text1.Text = Text1.Text & ct2 & "/" & goodct & "=" & mform(ct2 / goodct, "#.00000000000") & crlf
Text1.Text = Text1.Text & ct3 & "/" & greenNotInBlue & "=" & mform(ct3 / greenNotInBlue, "#.00000000000") & crlf
Text1.Text = Text1.Text & "done"
End Sub
finds for parts (i), (ii), and (iii), respectively:
14/1300= .01076923077
933/1300= .71769230769
168/1101= .15258855586
The numerators and denominators are the actual counts, but the fractions reduce to
(i) 7/650
(ii) 933/1300
(iii) 56/367
|
Posted by Charlie
on 2014-09-11 16:36:33 |