Context:
Although I am comfortable with much of undergraduate-level math, probability is something I rarely venture into, bizarrely. Hence, I thought I'd come up with a recreational problem.
Suppose I have some $M(n)$ sided die, where $n\in\mathbb{N}$ is the number of rolls so far. That is, $M$ is dependent on $n$.
Question:
Given $M(n)$, how do we calculate the average number of rolls it takes to roll a $1$?
What I've got so far,
I assume the information I'm looking for is extracted from the likelihood of halting after $n$ rolls. Clearly, the chance of rolling a $1$ on roll $k$ is $\frac{1}{M(k)}$. Thus, I believe the likelihood of halting after $n$ rolls is $$1-\prod_{k=1}^n\left(1-\frac{1}{M(k)}\right),$$ unless I am mistaken. Where do I go from here? I assume some sort of summation is involved.
If we get a 1 for the first time from the $n$th roll, we didn't get 1 from the previous $n-1$ rolls but we got it once from the $n$th roll. So the probability is:
$$\frac{1}{M(n)} \prod_{k=1}^{n-1} \bigg(1-\frac{1}{M(k)}\bigg)$$
The expected number of rolls is the sum of the products of $n$ and the probability of halting at $n$. Thus the answer is:
$$\sum_{n=1}^\infty \Bigg( \frac{n}{M(n)} \prod_{k=1}^{n-1} \bigg(1-\frac{1}{M(k)}\bigg)\Bigg)$$