I know the individual chance for an event with probability $X$ happening $Y$ times in a row is $X^Y$.
But what if I want to know how many times this event with probability $X$ will happen $Y$ times in a row over $Z$ number of attempts?
This is the algorithm
success_counter = 0
counter_Y = 0
loop Z {
if (chance(X) === success) {
success_counter++
if (success_counter === Y) { // We succeeded Y times in a row
counter_Y++ // We save this on a counter
success_counter = 0 // We reset the success counter after we reach Y
}
} else
success_counter = 0 // We reset the success counter on failure
}
If I convert that to python code and run it with these parameters:
- $X = 92\%$
- $Y = 10$
- $Z = 1.000.000.000$
I get that it succeeded $Y=10$ times in a row a total of $61.443.862$ times, which is around $6.14\%$
But what I want to know is, can I calculate this for any case?
At first I thought of "running" it in batches of 10, but that's where my problem is. When you don't consider the number of attempts, then you make each result independent of each other, which in this case is wrong.
To be honest I don't have the technical knowledge to understand the answers (also english is not my main language which makes it harder) but I think it's the exact same question
– Kyuuri Jul 04 '23 at 13:40