How to determine probability of an outcome when the number of tries is variable. Given a known probability of an event being successful, how do you calculate the odds of at least one successful outcome when the number of times you can attempt is determined by a separate dice roll.
For example:  I know the probability of a favorable outcome on dice X is "P".      I first roll a six sided dice. That dice roll determines the number times I can roll dice X.  What is the probability that I will have at least one successful roll of dice X as a function of "P"?

Lets say the outcome of first dice roll is $k(1 \le k \ge 6$) each with probability $\frac{1}{6}$.
P(atleast 1 success)= 1-P(no success)
P(atleast 1 success) = P(k=1)(1-P(no success with 1 throws)) + P(k=2)(1-P(no success with 2 throws))+...6 terms
Since P(k=1)=P(k=2)=...=P(k=6)=1/6
Hence
P(atleast 1 success) = $\frac{1}{6} \sum_{k=1}^6$ (1-P(no success with k throws))
Thus the required answer is:
P(atleast 1 success) = $\frac{1}{6} \sum_{k=1}^6$ $(1-(1-p)^k$)
where $p$ is probability of favorable outcome given in question.
