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

 Trading cards (Posted on 2002-05-03)
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

•  See The Solution Submitted by levik Rating: 4.1818 (11 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 re(2): a method of solving problem B | Comment 30 of 36 |
(In reply to re: a method of solving problem B by Charlie)

This is the program that implements Steve Hutton's algorithm, as modified:
DEFDBL A-Z
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

p(0, 1) = 1 ' generation 1 where m = 1
FOR m = 2 TO 15000
FOR n = 1 TO m
IF n > 200 THEN EXIT FOR
p(1, n) = p(0, n) * n / 200 + p(0, n - 1) * (201 - n) / 200
p(0, n - 1) = p(1, n - 1)
NEXT
p(0, n - 1) = p(1, n - 1)
s = -INT(-m / 5)
expVal = expVal + s * (p(1, 200) - prevProb)
prevProb = p(1, 200)
NEXT

PRINT expVal, p(1, 200)
 Posted by Charlie on 2003-02-05 08:57:29

Please log in:
 Login: Password: Remember me: Sign up! | Forgot password

 Search: Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (5)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2018 by Animus Pactum Consulting. All rights reserved. Privacy Information