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?)
The program:
DIM card(52)
DIM denCt(13)
DIM howMany(27)
RANDOMIZE TIMER
FOR i = 1 TO 52
card(i) = i
NEXT
FOR trial = 1 TO 1000000
FOR i = 1 TO 13
denCt(i) = 0
NEXT
FOR i = 1 TO 52
s = INT(52 * RND(1) + 1)
IF i <> s THEN SWAP card(i), card(s)
NEXT
FOR i = 1 TO 27
den = INT((card(i)  1) / 4) + 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
produces during a specific run
1 0
2 0
3 2386
4 7009
5 13553
6 21802
7 32049
8 43066
9 54850
10 65895
11 75718
12 84492
13 88909
14 90652
15 87690
16 81244
17 71369
18 58910
19 44953
20 32297
21 21086
22 12229
23 6194
24 2532
25 867
26 216
27 32
Clearly 14 is the modal number of cards dealt, which is presumably what the puzzle is calling for.
(at numbers like 90,000 the uncertainty of the true mean is give or take about 300 or so).

Posted by Charlie
on 20031119 16:25:47 