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 (e1)/(e*c1). 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) * (e1)/(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.
list
10 for T=1 to 100
20 for Colors=2 to 30
25 if Colors>=T then goto 80
30 NEach=TColors
40 PSame=(NEach1)//(Colors*NEach1)
50 PSame2=(Colors*NEach)//(Colors*NEach+20)*(NEach1)//(Colors*NEach+19)
60 PSame2=PSame2+20//(Colors*NEach+20)*19//(Colors*NEach+19)
70 if PSame=PSame2 then print Colors;NEach,PSame;1//PSame
80 next Colors
90 next T
OK
run
19 10 1//21 21
OK
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 20081111 18:22:28 