All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Simple coins (Posted on 2002-04-09)
I toss two coins and look at the outcome. I then tell you that at least one of the coins is showing up as "tails". What is the chance that the other one is showing "tails" as well?

(from techInterview.org)

 See The Solution Submitted by art Rating: 3.8750 (16 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 re(2): Question On The Solution | Comment 40 of 45 |
(In reply to re: Question On The Solution by Charlie)

In fact, a simulation follows:

OPEN "cointoss.txt" FOR OUTPUT AS #2
FOR trial = 1 TO 400
coin1\$ = MID\$("ht", INT(RND(1) * 2) + 1, 1)
coin2\$ = MID\$("ht", INT(RND(1) * 2) + 1, 1)
PRINT #2, coin1\$; coin2\$; "  ";
which = INT(RND(1) * 2) + 1
SELECT CASE which
CASE 1: report\$ = coin1\$
CASE 2: report\$ = coin2\$
END SELECT
PRINT #2, CHR\$(34); "At least one is a ";
IF report\$ = "h" THEN PRINT #2, "heads"; : ELSE PRINT #2, "tails";
PRINT #2, "."; CHR\$(34)
IF report\$ = "t" THEN
tailRpt = tailRpt + 1
IF coin1\$ = "t" AND coin2\$ = "t" THEN bothTails = bothTails + 1
END IF
NEXT
PRINT tailRpt, bothTails, bothTails / tailRpt
CLOSE

where the result had 193 cases of the narrator reporting at least one tails, in which 97 cases were of both being tails, for an observed probability of  .5025907.  In each case the choice as to which to report was made randomly with equal probability; it was not always the first one or always the second one, and no preference was given to reporting either heads or tails.

`tt  "At least one is a tails."hh  "At least one is a heads."ht  "At least one is a tails."th  "At least one is a tails."tt  "At least one is a tails."tt  "At least one is a tails."th  "At least one is a heads."th  "At least one is a heads."hh  "At least one is a heads."th  "At least one is a tails."tt  "At least one is a tails."tt  "At least one is a tails."tt  "At least one is a tails."th  "At least one is a heads."th  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."th  "At least one is a tails."hh  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a heads."ht  "At least one is a heads."ht  "At least one is a heads."th  "At least one is a tails."tt  "At least one is a tails."hh  "At least one is a heads."tt  "At least one is a tails."ht  "At least one is a tails."ht  "At least one is a tails."th  "At least one is a tails."hh  "At least one is a heads."ht  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."tt  "At least one is a tails."tt  "At least one is a tails."hh  "At least one is a heads."ht  "At least one is a tails."th  "At least one is a tails."hh  "At least one is a heads."hh  "At least one is a heads."tt  "At least one is a tails."hh  "At least one is a heads."hh  "At least one is a heads."tt  "At least one is a tails."ht  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a heads."hh  "At least one is a heads."th  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a tails."tt  "At least one is a tails."th  "At least one is a heads."ht  "At least one is a heads."tt  "At least one is a tails."hh  "At least one is a heads."th  "At least one is a tails."ht  "At least one is a tails."th  "At least one is a heads."tt  "At least one is a tails."th  "At least one is a tails."ht  "At least one is a heads."ht  "At least one is a tails."th  "At least one is a heads."ht  "At least one is a heads."tt  "At least one is a tails."hh  "At least one is a heads."th  "At least one is a heads."ht  "At least one is a heads."ht  "At least one is a tails."tt  "At least one is a tails."th  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."tt  "At least one is a tails."hh  "At least one is a heads."th  "At least one is a heads."th  "At least one is a heads."th  "At least one is a tails."hh  "At least one is a heads."tt  "At least one is a tails."th  "At least one is a tails."ht  "At least one is a heads."th  "At least one is a tails."hh  "At least one is a heads."tt  "At least one is a tails."th  "At least one is a tails."hh  "At least one is a heads."ht  "At least one is a tails."tt  "At least one is a tails."ht  "At least one is a heads."tt  "At least one is a tails."hh  "At least one is a heads."th  "At least one is a heads."tt  "At least one is a tails."tt  "At least one is a tails."tt  "At least one is a tails."ht  "At least one is a tails."th  "At least one is a tails."hh  "At least one is a heads."hh  "At least one is a heads."tt  "At least one is a tails."ht  "At least one is a heads."ht  "At least one is a heads."hh  "At least one is a heads."th  "At least one is a tails."tt  "At least one is a tails."th  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."th  "At least one is a heads."ht  "At least one is a tails."hh  "At least one is a heads."ht  "At least one is a heads."th  "At least one is a heads."th  "At least one is a heads."ht  "At least one is a tails."tt  "At least one is a tails."ht  "At least one is a heads."ht  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a heads."ht  "At least one is a heads."tt  "At least one is a tails."tt  "At least one is a tails."ht  "At least one is a tails."hh  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."th  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a tails."th  "At least one is a tails."hh  "At least one is a heads."ht  "At least one is a tails."tt  "At least one is a tails."hh  "At least one is a heads."tt  "At least one is a tails."ht  "At least one is a tails."th  "At least one is a tails."ht  "At least one is a heads."th  "At least one is a heads."ht  "At least one is a heads."tt  "At least one is a tails."th  "At least one is a heads."th  "At least one is a tails."th  "At least one is a tails."th  "At least one is a tails."hh  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."th  "At least one is a heads."th  "At least one is a heads."tt  "At least one is a tails."tt  "At least one is a tails."th  "At least one is a heads."th  "At least one is a tails."hh  "At least one is a heads."tt  "At least one is a tails."ht  "At least one is a tails."th  "At least one is a heads."hh  "At least one is a heads."th  "At least one is a tails."tt  "At least one is a tails."tt  "At least one is a tails."hh  "At least one is a heads."hh  "At least one is a heads."tt  "At least one is a tails."hh  "At least one is a heads."tt  "At least one is a tails."ht  "At least one is a tails."th  "At least one is a heads."hh  "At least one is a heads."tt  "At least one is a tails."tt  "At least one is a tails."th  "At least one is a tails."tt  "At least one is a tails."th  "At least one is a heads."th  "At least one is a heads."hh  "At least one is a heads."th  "At least one is a tails."th  "At least one is a tails."tt  "At least one is a tails."hh  "At least one is a heads."tt  "At least one is a tails."tt  "At least one is a tails."tt  "At least one is a tails."th  "At least one is a heads."hh  "At least one is a heads."th  "At least one is a tails."ht  "At least one is a heads."ht  "At least one is a tails."tt  "At least one is a tails."tt  "At least one is a tails."hh  "At least one is a heads."hh  "At least one is a heads."th  "At least one is a tails."tt  "At least one is a tails."hh  "At least one is a heads."tt  "At least one is a tails."ht  "At least one is a tails."ht  "At least one is a tails."hh  "At least one is a heads."th  "At least one is a tails."th  "At least one is a heads."th  "At least one is a tails."ht  "At least one is a heads."th  "At least one is a heads."ht  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a heads."hh  "At least one is a heads."tt  "At least one is a tails."tt  "At least one is a tails."ht  "At least one is a heads."tt  "At least one is a tails."tt  "At least one is a tails."ht  "At least one is a tails."th  "At least one is a tails."ht  "At least one is a tails."th  "At least one is a tails."hh  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a tails."hh  "At least one is a heads."th  "At least one is a tails."th  "At least one is a tails."tt  "At least one is a tails."hh  "At least one is a heads."th  "At least one is a tails."hh  "At least one is a heads."tt  "At least one is a tails."ht  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a tails."th  "At least one is a tails."hh  "At least one is a heads."th  "At least one is a heads."tt  "At least one is a tails."hh  "At least one is a heads."tt  "At least one is a tails."ht  "At least one is a heads."tt  "At least one is a tails."tt  "At least one is a tails."ht  "At least one is a heads."th  "At least one is a heads."ht  "At least one is a heads."tt  "At least one is a tails."tt  "At least one is a tails."tt  "At least one is a tails."ht  "At least one is a tails."th  "At least one is a tails."th  "At least one is a tails."hh  "At least one is a heads."ht  "At least one is a tails."th  "At least one is a heads."ht  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a tails."ht  "At least one is a tails."tt  "At least one is a tails."tt  "At least one is a tails."th  "At least one is a tails."ht  "At least one is a heads."tt  "At least one is a tails."tt  "At least one is a tails."hh  "At least one is a heads."th  "At least one is a tails."hh  "At least one is a heads."tt  "At least one is a tails."hh  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a tails."ht  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a heads."hh  "At least one is a heads."tt  "At least one is a tails."tt  "At least one is a tails."th  "At least one is a tails."th  "At least one is a tails."ht  "At least one is a heads."ht  "At least one is a tails."th  "At least one is a tails."ht  "At least one is a tails."hh  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a tails."th  "At least one is a heads."ht  "At least one is a tails."ht  "At least one is a heads."th  "At least one is a tails."tt  "At least one is a tails."tt  "At least one is a tails."hh  "At least one is a heads."tt  "At least one is a tails."ht  "At least one is a heads."ht  "At least one is a heads."ht  "At least one is a tails."tt  "At least one is a tails."tt  "At least one is a tails."hh  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a tails."tt  "At least one is a tails."ht  "At least one is a tails."hh  "At least one is a heads."hh  "At least one is a heads."th  "At least one is a tails."ht  "At least one is a heads."ht  "At least one is a tails."ht  "At least one is a tails."th  "At least one is a tails."tt  "At least one is a tails."tt  "At least one is a tails."tt  "At least one is a tails."ht  "At least one is a tails."tt  "At least one is a tails."th  "At least one is a heads."th  "At least one is a tails."ht  "At least one is a tails."ht  "At least one is a tails."th  "At least one is a heads."hh  "At least one is a heads."tt  "At least one is a tails."tt  "At least one is a tails."th  "At least one is a tails."ht  "At least one is a tails."ht  "At least one is a heads."hh  "At least one is a heads."tt  "At least one is a tails."hh  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a heads."tt  "At least one is a tails."ht  "At least one is a tails."th  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a heads."ht  "At least one is a heads."ht  "At least one is a heads."th  "At least one is a tails."tt  "At least one is a tails."ht  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a heads."th  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a heads."ht  "At least one is a tails."th  "At least one is a tails."tt  "At least one is a tails."ht  "At least one is a heads."th  "At least one is a heads."hh  "At least one is a heads."tt  "At least one is a tails."ht  "At least one is a heads."tt  "At least one is a tails."th  "At least one is a heads."tt  "At least one is a tails."hh  "At least one is a heads."tt  "At least one is a tails."hh  "At least one is a heads."ht  "At least one is a heads."tt  "At least one is a tails."tt  "At least one is a tails."ht  "At least one is a heads."th  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."ht  "At least one is a tails."hh  "At least one is a heads."th  "At least one is a heads."hh  "At least one is a heads."hh  "At least one is a heads."th  "At least one is a tails."tt  "At least one is a tails."th  "At least one is a tails."tt  "At least one is a tails."th  "At least one is a heads."hh  "At least one is a heads."tt  "At least one is a tails."tt  "At least one is a tails."th  "At least one is a heads."`

 Posted by Charlie on 2007-10-24 10:38:57

 Search: Search body:
Forums (0)