TITLE: Simplifying or approximating $\sum_{k=1}^{\infty}\left(1 - \left(1 - 2^{-k}\right)^n\right)$?
QUESTION [5 upvotes]: Consider a game in which you flip a coin until you flip tails. Your score is then the number of heads you flipped. So, for example, the sequence $H$, $H$, $H$, $T$ has a score of three, while the sequence $T$ has score zero. You play this game $n$ times. Let $X$ denote your maximum score in the game. I'd like to know what $E[X]$ looks like as a function of $n$.
Here's what I know so far. The probability that your score is greater than or equal to some number $k$ is equal to $$\left(1 - \left(1 - 2^{-k}\right)^n\right),$$ which is the probability that you don't have all scores strictly below $k$. We can then write $E[X]$ as follows:
$$\begin{aligned}
E[X] & = \sum_{k = 0}^{\infty} k \cdot Pr[X = k] \\
     & = \sum_{k = 1}^{\infty} Pr[X \ge k] \\
     & = \sum_{k = 1}^{\infty} \left(1 - \left(1 - 2^{-k}\right)^n\right).
\end{aligned}$$
At this point, I'm completely out of my league in terms of sequence manipulations, and I'm not sure how to simplify this or even interpret what this looks like.
I know that I can write
$$(1 - 2^{-k})^n = ((1 - 2^{-k})^{2^{k}})^{n 2^{-k}} \approx e^{-n 2^{-k}},$$
which lets me rewrite the sum as being (approximately)
$$\sum_{k = 1}^{\infty} (1 - e^{-n 2^{-k}}),$$
but (1) I don't know how much this messes up the estimate and (2) I still have no idea how to simplify or manipulate this sum.
I know that for $n \ll 2^k$ that the term in the sum is close to 0 and that for $n \gg 2^k$ the term in the sum is close to 1, so I'm expecting this sum to come out to something like $\alpha \log_2 n + o(\log_2 n)$ or something like that, but I'm not sure how to rigorously quantify this.
Is there a nice way to simplify this sum or otherwise get a decent approximation of it?
(Context: I'm teaching the HyperLogLog estimator and while the full analysis is way too complex to put into a lecture, I'd still like to give some intuitions as to why it works. The game discussed here is equivalent to looking at leading zeros in a random hash, and the distribution of the maximum score is useful for analyzing the expected value of a simple estimator.)

REPLY [3 votes]: Using @Mike Spivey's answer to this question
$$E_n = \sum_{k=0}^{\infty} (1 - (1-q^k)^n)$$
$$\int_0^{\infty} (1 - (1 - q^x)^n) dx \leq E_n \leq 1 + \int_0^{\infty} (1 - (1 - q^x)^n) dx$$ for $q=\frac 12$ we have
$$\frac{n (\psi (n)+\gamma )+1}{n \log (2)}\leq E_n \leq 1 +\frac{n (\psi (n)+\gamma )+1}{n \log (2)}$$
So, almost exact
$$\sum_{k = 1}^{\infty} \left(1 - \left(1 - 2^{-k}\right)^n\right)\sim \frac{n H_{n-1}+1}{n \log (2)}-\frac{1}{2}$$
For example, for $n=50$, the xact value is
$5.9909779$ while the approximation gives $5.9909812$.