Here are the answers to Question Set 2 on the Rockets page:
6((5⁄6)15) isn't the final answer though. When we add the number of possibilities that don't contain white to the number of possibilities that don't contain pink, the possibilities that contain neither white nor pink have been double-counted. How many of them are there?
The probability that a roll will not contain any two specific colours (say, white and pink) is (4⁄6)15 = (2⁄3)15. There are 6 C 2 = 15 combinations of two different colours. However, just as 6((5⁄6)15) isn't the answer for one missing colour, (6 C 2)(2⁄3)15 is not the answer for two colours, because possibilities missing three colours are double-counted.
Similarly, once we find the number of possibilities where three colours are missing, we'll have to subtract the number of possibilities where four colours are missing, and to find the number of possibilities where four colours are missing, we'll have to find the number of possibilities where five colours are missing. Once we get to the bottom of this and reconstruct the answer, we get (and be sure to be very careful with the signs, there is a quadruple negative here):
Thinking recursively can help in solving this problem. It can also help to try a smaller case, say with four candies in a roll and four colours, and apply your answer to the larger case.
#!/usr/bin/perl -wl $trials = 10000000; $success = 0; for ($i = 0; $i < $trials; $i++) { @colours = (0, 0, 0, 0, 0, 0); # Nothing in roll yet. for ($j = 0; $j < 15; $j++) { $colours[int(rand(6))] = 1 # Note that we've found specified colour. } # If one of the colours is 0, multiplying all of them together will # result in 0, If that's the case, increment number of successes. $success++ unless $colours[0] * $colours[1] * $colours[2] * $colours[3] * $colours[4] * $colours[5]; } print $success/$trials;