Hello expected output (probability question) I am working on a probability problem
I tried finding the total net productivity days based on the amount of machines the factory has, so if there was 1 machine, there will be 29 days * 1 machine = 29 output. But as machines increase, probability also comes into play. So if there were 2 machines there will be 29 days * 1 machine + 28/30 * 28 days * 2 machines.
and so on..
Is my reasoning correct? Also I have no idea where to go from here because starting for 3 machines, things get even more complicated.
Please help! Thanks !
 A: Let's assume that each machine produces one unit per day, and there are $30$ days in the month. Let $X_i$ be the day of failure of the $i^{\mathrm{th}}$ machine, for $i=1,2,\ldots$, then the $X_i$ are i.i.d. with common distribution
$$\mathbb P(X_i=k)=\begin{cases}\frac1{30},& k\in\{1,2,\ldots,30\}\\0,&\text{otherwise}.\end{cases} $$
For a positive integer $n$, the number of units produced in a month is 
$$O_n = n\sum_{k=1}^{30} \prod_{i=1}^n (1-\mathbb I_{X_i=k}), $$
where
$$\mathbb I_{X_i=k}=\begin{cases}1,& X_i=k\\0,&\text{otherwise}.\end{cases} $$
In other words, $O_n$ is $n$ times the number of productive days in the month. Since the $X_i$ are i.i.d. we can compute the expectation as
$$
\begin{align*}
\mathbb E[O_n] &= n\mathbb E\left[\sum_{k=1}^{30}\prod_{i=1}^n (1-\mathbb I_{X_i=k})\right]\\
&= n\sum_{k=1}^{30} \mathbb E\left[\prod_{i=1}^n (1-\mathbb I_{X_i=k})\right]\\
&= n\sum_{k=1}^{30} \prod_{i=1}^n\mathbb E[1-\mathbb I_{X_i=k}]\\
&= n\sum_{k=1}^{30} \prod_{i=1}^n (1-\mathbb P(X_i=k))\\
&= n\sum_{k=1}^{30} (1-\mathbb P(X_1=k))^n\\
&= n\sum_{k=1}^{30} \left(1 - \frac1{30}\right)^n\\
&= 30n\left(\frac{29}{30}\right)^n.
\end{align*}
$$
To maximize this, let $f(x)=30x\left(\frac{29}{30}\right)^x$ for $1\leqslant x<\infty$, then
$$ f'(x) = 30\left(\frac{29}{30}\right)^x(1+x(\log 29 - \log 30)).$$
We see that $f'$ is positive on $[1,(\log(30)-\log(29))^{-1})$ and negative on $((\log(30)-\log(29))^{-1},\infty)$. Hence, the maximizing value is
$$n^* = \max\{n|n < (\log(30)-\log(29))^{-1}\} = 29.$$
A: Suppose there are 30 days to every month, and the factory has n
machines.  Consider machine 1 on day 1. The probability that this
machine is operating on day 1 is 29/30.  This is also true for machines
2, 3, etc.  The machines are all independent of each other, so the
probability that they are all operating on day 1 is (29/30)**n.  So the
expected output on day #1 is proportional to n*(29/30)**n.  There are 30 days in a month, so the expected monthly output is proportional to 30*n*(29/30)**n.  You want to maximize this function with respect to n.
A: I think this might work. 
First, find the expected number of down days for $k$ machines. The first machine adds $1$ down day on average, the second machine adds $29/30$ down days on average, the third machine adds $841/900$ down days on average, and in general, the $k$th machine adds $(29/30)^{k-1}$ down days on average. Thus, the expected number of down days for $k$ machines is
$$
D_k = \sum_{i=1}^k r^{k-1}= \frac{1-r^k}{1-r}
$$
where $r = 29/30$. Then, we want to maximize $k(30-D_k) = k[1/(1-r)-D_k] = kr^k/(1-r)$.  If we treat $k$ for the moment as a continuous variable, we find that this expression attains a maximum when $k \ln r = -1$, or at $k = -1/\ln r \doteq 1/(1-r)$, and indeed substituting $1/(1-r)-1$ and $1/(1-r)$ for $k$ in the expression $kr^k/(1-r)$ reveals that they have the same result for the total expected output: the maximum value of $r^{1/(1-r)}/(1-r)^2 = 900(29/30)^{30} \doteq 325.50$.
