I know of the standard way to solve probability questions like the following:
If a die is rolled 12 times, what is the probability of rolling 4 sixes?
But I want to consider the reverse case:
If someone preformed an experiment with a die, and they told us that in the experiment the number six came up 4 times, then what is the probability the die was rolled 12 times?
I would like to start with the general case only in a binomial probability. So what I am trying to solve is the following:
Given an event with two possible outcomes, $A$ with probability $p$ and $B$ with probability $1-p$, what is the probability that the experiment was preformed $N$ times given that $A$ has occurred $n$ times?
The problem is poorly worded. I'm interpreting as the following:
Problem
What is the expected number of rolls of a fair six-sided die until exactly $4$ $5$s appear?
Solution
Start by asking: What is the probability that you stop after exactly $n$ rolls?
The only way you stop after exactly $n$ rolls is if you roll exactly $3$ $5$s in $n-1$ rolls, and a $5$ on the final ($n$th) roll. That probability is:
$$P(stop\ at\ n) = P(three\ 5s\ after\ n-1\ rolls) P(a\ 5\ on\ roll\ n) =$$
$$\left( {n-1 \choose 3}(1/6)^3 (5/6)^{n - 1 - 3} \right) \cdot {1 \over 6}$$
Here's a graph of that probability. Notice that the value is $0$ for $n<4$ (of course).
Now you want to calculated the expected value of $n$. So multiply the probability you stop at $n$ times the value $n$ itself, and sum up over all possible values of $3<n<\infty$.
$$\sum\limits_{n=4}^\infty n \left( {n-1 \choose 3}(1/6)^3 (5/6)^{n - 1 - 3} \right) \cdot {1 \over 6} = 24.$$
The expected value is $24$... which of course makes sense!