Last Red Candy Probability
What does “success” mean?
When the last red candy is removed, at least one blue and one green must still remain. Equivalently, the last red must appear before both the last blue and the last green.
Bad event 1: blue runs out first
Ignore all green candies. Among the 10 red and 20 blue candies, the last candy is equally likely to be any one of those 30 candies.
For the last blue to occur before the last red, the final candy among red+blue must be red.
Bad event 2: green runs out first
Ignore all blue candies. Among the 10 red and 30 green candies, the last candy is equally likely to be any one of those 40 candies.
For the last green to occur before the last red, the final candy among red+green must be red.
Correct the double-counting
Both bad events happen simultaneously exactly when red is the color of the very last candy overall.
By inclusion–exclusion:
Monte Carlo check
Shuffle all 60 candies repeatedly and check whether
lastRed < lastBlue and lastRed < lastGreen.