### 538 Riddler: Puzzle of the Monsters' Gems

#### 26 May ’16

There are three ways that this game can end: slaying a rare monster (the most likely), slaying an uncommon monster, or slaying a common monster (the least likely). I began by thinking about the probability of each of these events happening. The probability of the game ending by slaying a rare monster can be expressed as the following:

Extending that same logic, we can calculate the probability that we end the game by slaying an uncommon and common monster as well:

...these sum to 1 and match what we would expect directionally.

Next, I added the expected number of common monsters slayed to each of these scenarios. If the game ends by slaying a common monster (which only happens 15% of the time), this is simply 1. In the other two scenarios, the number of common monsters slayed is a binomial random variable, conditioned on not all the previously slayed monsters being of a single type. Bayes helps us reduce the expression:

Putting this all together: