A trading card series has 200 different cards in it, which are sold in 5-card packages.
Each package has a random sampling of the cards (assume that any card of the 200 has an equal chance of being in a package).
On the average, how many packages will need to be bought to collect the complete series if...
A: all the cards in a package will always be different
B: a package can have repeats
(In reply to
re: Simulation results by Charlie)
I haven't used BASIC in a few years so please bare with me. Can you try somthing like this as your simulation and post the results?
You can also add another loop to make sure none of the cards in 'pack' are the same. This would simulate A.
RANDOMIZE TIMER
tot = 0: totI = 0
DO
REDIM c(200)
ct = 0: ctr = 0
DO
REDIM pack(5) 'Individual pack
FOR packetCnt = 1 TO 5
r = INT(RND(1) * 200 + 1)
packet(packCnt) = r ' fill in each card in the pack
NEXT
FOR packetCnt = 1 TO 5 ' see if we already have a card from the pack
r = packet( packCnt )
IF c(r) = 0 THEN
c(r) = 1
ct = ct + 1 ' ct must get to 200 each trial
END IF
NEXT
ctr = ctr + 1 ' ctr is number of purchases for a complete set
IF ct = 200 THEN EXIT DO
LOOP
totI = totI + ctr ' Number of packs
numTry = numTry + 1
PRINT numTry, ctr, totI / numTry
LOOP
|
Posted by Tony
on 2003-01-29 13:25:16 |