When to turn the power off? I tought of this problem a while ago
Imagine you own a casino. At the start of every day (12:00am) each hour there is 25% chance that all the guests will leave and you will need to turn off the power, so you should expect it to be, on average, 4 hours after midnight. Your little casino does well and you decide to open another one,with same probability of 25% that guests will leave after an hour. The problem is that the main power switch turns off and on both of your casinos, so you will need to turn it off only when both of them are empty. Whats the expected number of hours now? What about when you have 10 casinos? How do I get the formula for N number of casinos?
 A: First note that the situation with one casino is finding the expected value of a geometric random variable with the probability of success being $25\%.$  The random variable telling you when everyone has left all your casinos is the maximum of the random variables for each casino.
Formally, then, we define $X_i, 1\leq i \leq N$ to be geometric with $p=0.25$ (we may as well assume independent since the people in the casinos presumably don't communicate in any way with the other casinos) and $Y = \max\{X_i, 1\leq i\leq N\},$ and note we want $E[Y].$
To investigate this expected value, see the answers to Expectation of the maximum of i.i.d. geometric random variables
In particular, the answers there give the approximation
$$E[Y] = E[\max\{X_i\}] \approx \frac{1}{2} - \frac{H_N}{\ln(1-p)}$$
where $H_n = \sum_{k=1}^n \frac{1}{k}$ is the $n$th harmonic number.  For example, $p=0.25$ and $N=10$ yields
$E[Y] \approx 10.6812679$
A: The probability that a single casino has all its guests leave follows a geometric distribution $X$ with mass function:
$$
p(x) = (3/4)^{x-1}\cdot(1/4)
$$
where x is the number of hours after midnight all the guests leave.
In general, if we want all $n$ casinos to be empty when we shut off the power, we seek to find the expected value of the time it takes for all the casinos to be empty. Let $Y = \max(X_1,X_2,...,X_n)$. We want to find $E(Y)$.
The cumulative distribution function of the $i^{th}$ casino $X_i$ is $F(x_i) =  1 - (3/4)^{x_i}$.
$Y$ only occurs if all of the all the $n$ casinos individually has had all its guests leave. Thus, it is an order statistic with
$$
F(y) = F(x)^n = (1-(3/4)^x)^n
$$
and so its mass function is 
$$
p(y) = F(y) - F(y-1)
$$
$$
p(x_{max}) = F(x)^n - F(x-1)^n
$$
$$
p(x_{max}) = (1-(3/4)^x)^n-(1-(3/4)^{x-1})^n
$$
And so
$$
E(Y) = \sum_{x=1}^\infty x\cdot p(y) = \sum_{x=1}^\infty x\cdot ((1-(3/4)^x)^n-(1-(3/4)^{x-1})^n)
$$
For the case $n = 10$, the answer (according to Desmos) is about $10.681$.
