Expected number of coin tosses needed until all coins show heads We flip $n$ fair coins every iteration of the game. Every coin that shows heads is removed from the game and we use the remaining $n-k$ coins to play the game again (where $k$ is the number of heads in that iteration). What is the expected number of iterations we need to complete before all the coins are gone.

Note that each iteration of the game follows a binomial random variable, namely
$$X_r \sim B(N_r, 1/2),$$
where $N_r$ is the number of remaining coins in each try.
Now, the expectation of a Binomial random variable equals the probability parameter times the number of experiencies, in this case
$$\mathbb{E}(X_r)=\cfrac{N_r}{2}.$$
The formula above tells us about how many coins we might expect to keep at each iteration, that is,  $N_0 = n$, $$N_1 = n - \frac{n}{2} = \frac{n}{2} = \frac{N_0}{2}$$ and so on. Therefore,
$$N_r = \frac{N_{r-1}}{2}= \dots = N_02^{-r}=n2^{-r}.$$
Of course, this goes to zero when $r$ tends to $\infty$, so instead of asking when does this number equal zero, let's just compute when it is one, that is
$$N_r = 1 \Leftrightarrow n2^{-r}=1 \Leftrightarrow r = \log_2 n.$$
Then, when only one coin remains, we can reasonably expect to draw heads after 2 tries, so there you go, you can expect $\log_2 n + 2$ tries to get rid of all the coins. Put either the floor or the ceiling function, both answers are correct, since this is an expectation, meaning that it is not necessarily the actual number of iteartions.
