An urn contains a number of colored balls, with equal numbers of each color. Adding 20 balls of a new color to the urn would not change the probability of drawing (without replacement) two balls of the same color.
How many balls are in the urn? (Before the extra balls are added.)
If e is the number of each color and c is the number of colors, then before the new balls are added, the probability of a match would be (e-1)/(e*c-1). Once the 20 extra balls of a new color are added, this probability becomes conditional on whether the first ball chosen was the new color or one of the original colors. The probability is then c*e/(c*e+20) * (e-1)/(c*e+19) + 20/(c*e+20) * 19/(c*e+19).
The program evaluates these for up to 30 colors originally within the limitation of c+e not exceeding 100.
10 for T=1 to 100
20 for Colors=2 to 30
25 if Colors>=T then goto 80
70 if PSame=PSame2 then print Colors;NEach,PSame;1//PSame
80 next Colors
90 next T
19 10 1//21 21
It finds 10 of each of 19 colors resulting in a 1/21 probability of a match both before and after the addition of 20 balls of a new color.
So there were 190 balls in the urn before the 20 extra were added.
Posted by Charlie
on 2008-11-11 18:22:28