Bank vaults and probability

Let $E(n)$ be the expected number of vaults needed to obtain at least $n$ coins. By conditioning on the number $k$ of coins in the next vault, we have $$E(n)= \begin{cases} 0 &\text{if $n\le 0$}\\ 1+\displaystyle{\frac{1}{100}\sum_{k=1}^{100} E(n-k)} &\text{if $n > 0$} \end{cases} $$

To make this derivation explicit for $n>0$, let random variable $V_n$ be the number of vaults needed to obtain at least $n$ coins, and let (discrete uniform) random variable $C$ be the number of coins in a vault. By the law of total expectation, conditioning on $C$ yields \begin{align} \mathbb{E}(V_n)&=\sum_{k=1}^{100}\mathbb{E}(V_n|C=k)\mathbb{P}(C=k)\\ &=\sum_{k=1}^{100}(1+\mathbb{E}(V_{n-k}))\frac{1}{100}\\ &=1+\frac{1}{100}\sum_{k=1}^{100}\mathbb{E}(V_{n-k}) \end{align}

We want to compute $E(100)$, which turns out to be approximately 2.678. You can verify that $E(n)=1.01^{n-1}$ satisfies the recursion if $n>0$, so the exact value is $E(100)=1.01^{99}$.

enter image description here


It doesn't matter how many vaults there are - you open the first one you come to and it will have an amount of coins in which can be any number between 1 and 100 with equal probability.

You pocket all those coins and move onto the next vault. This vault also has between 1 and 100 coins in, again with equal probability for each number.

You add together these coins and the ones already in your pocket. If this number is greater than or equal to 100 then you stop and leave with your 100 coins. If you have less than 100 coins, then you pocket all the coins and move on to the next vault, repeating the process until you have the desired 100 coins

Tags:

Probability