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"?
 A: P(desired outcome from N rolls) will be P(desired outcome from 1 roll)^N if you want each roll to satisfy a given condition. 
P(at least 1 * desired outcome from N rolls) will be 1-P(not desired outcome)^N.
P(at least M * desired outcome from N rolls, $N \geq M$) will be 
$1-\sum_{b=0}^{M-1} {N \choose b} \left(\frac {1} {P(desired outcome)}\right)^N$
A: 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.
A: *

*If you roll the X die $k$ times, the probability of failing on all $k$ times  is $(1-p)^k$.


*Hence the probability of succeeding at least once in $k$ tries is $1-(1-p)^k$. (because succeeding at least once and failing every time are complementary events.)


*Because the initial die roll is independent of the X die roll, their probabilities multiply. The probability of succeeding when you roll a six-sided die then roll your X die that many times is:
$$\sum_{k=1}^6 \frac{1}{6}\times \left[1-(1-p)^k\right] = 1-\frac{1}{6}\sum_{k=1}^6(1-p)^k$$


*The geometric sum formula states that $\sum_{k=1}^n q^k = \frac{q(1-q^n)}{1-q}$.  In our case, this means that the overall probability of success with a $n=6$ sided die and $q=(1-p)$ geometric probability is:
$$1-\frac{1}{6}\frac{(1-p)(1-(1-p^6))}{p},$$ which, if you like, is just the polynomial
$$\Pr(p) = -\frac{1}{6}\left(p^6 - 7p^5 + 21 p^4 -35 p^3 + 35 p^2 - 21 p^1 \right)$$


*As an example, when $p=\frac{1}{2}$ (X is a two-sided coin), the probability is around 0.83. When $p=\frac{1}{6}$ (X is another six-sided die), the probability is around 0.45.
