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

 Three of a Kind (Posted on 2003-11-19)
You have a standard pack of 52 playing cards. You then shuffle them and begin to draw out cards until you have three of a kind. What is the most likely number of cards drawn when this happens?

You then shuffle another pack of 52 playing cards into the pile. What happens to the expected number of cards now? (i.e. does it double / halve / stay the same?)

 No Solution Yet Submitted by Lewis Rating: 4.3333 (9 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 2-deck simulation | Comment 6 of 39 |
The program

DIM card(104)
DIM denCt(13)
DIM howMany(27)
DIM cum(27)

RANDOMIZE TIMER

FOR i = 1 TO 104
card(i) = i
NEXT

FOR trial = 1 TO 1000000
FOR i = 1 TO 13
denCt(i) = 0
NEXT
FOR i = 1 TO 104
s = INT(104 * RND(1) + 1)
IF i <> s THEN SWAP card(i), card(s)
NEXT
FOR i = 1 TO 27
den = INT((card(i) - 1) / 8) + 1
denCt(den) = denCt(den) + 1
IF denCt(den) > 2 THEN EXIT FOR
NEXT
howMany(i) = howMany(i) + 1
NEXT
FOR i = 1 TO 27: PRINT USING "## ######"; i; howMany(i): NEXT
FOR i = 1 TO 27
cum(i) = cum(i - 1) + howMany(i)
IF cum(i) > 500000 THEN
IF med = 0 THEN
med = i - 1 + (500000 - cum(i - 1)) / (howMany(i))
PRINT "Median is"; med
END IF
END IF
tot = tot + howMany(i) * i
NEXT
PRINT "Mean is"; tot / 1000000

Finds a mode of 12, median of 11.67 and mean of 12.22:

1 0
2 0
3 4009
4 11305
5 21487
6 34033
7 47959
8 62189
9 74922
10 85932
11 93636
12 96659
13 94847
14 88035
15 78512
16 64317
17 50641
18 36789
19 24680
20 15192
21 8242
22 4099
23 1727
24 608
25 151
26 28
27 1
Median is 11.66758
Mean is 12.215842

 Posted by Charlie on 2003-11-19 17:34:52

 Search: Search body:
Forums (0)