A trading card series has 200 different cards in it, which are sold in 5card 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: a method of solving problem A by Charlie)
The program used to implement Steve Hutton's algorithm, as modified, is:
DEFDBL AZ
DIM p(1, 200)' second subscript is # of unique cards gained
' first is 0 for old generation (# of cards drawn) and 1 for
' next generation of # of cards drawn
denom = 200# * 199 * 198 * 197 * 196
p(0, 5) = 1 ' generation 1 where s = 1, certain to have 5 unique cards
FOR s = 2 TO 15000
FOR n = 5 TO 5 * s
IF n > 200 THEN EXIT FOR
i = 0: x = n  i
p(1, n) = p(0, x) * x * (x  1) * (x  2) * (x  3) * (x  4) / denom
i = 1: x = n  i
p(1, n) = p(1, n) + 5 * p(0, x) * x * (x  1) * (x  2) * (x  3) * (200  x) / denom
i = 2: x = n  i
p(1, n) = p(1, n) + 10 * p(0, x) * x * (x  1) * (x  2) * (200  x) * (200  x  1) / denom
i = 3: x = n  i
p(1, n) = p(1, n) + 10 * p(0, x) * x * (x  1) * (200  x) * (200  x  1) * (200  x  2) / denom
i = 4: x = n  i
p(1, n) = p(1, n) + 5 * p(0, x) * x * (200  x) * (200  x  1) * (200  x  2) * (200  x  3) / denom
i = 5: x = n  i
p(1, n) = p(1, n) + p(0, x) * (200  x) * (200  x  1) * (200  x  2) * (200  x  3) * (200  x  4) / denom
NEXT
FOR n = 5 TO 5 * s
IF n > 200 THEN EXIT FOR
p(0, n) = p(1, n)
NEXT
expVal = expVal + s * (p(1, 200)  prevProb)
prevProb = p(1, 200)
NEXT
PRINT expVal, p(1, 200)

Posted by Charlie
on 20030206 09:07:50 