Skip to main content
2 of 3
edited title

If I make N trials, each independent with p chance of success, what is the probability that X or more of them will be successful?

In my problem, p, X, and N are fixed and I want to know the probability. Currently, I am calculating this recursively, as for any given p,X,N, the probability is:

function Prob(p,X,N) {
  return p*Prob(p,X-1,N-1) + (1-p)*Prob(p,X,N-1)
}

The intuition behind this is that if we were successful (first term) we have X-1 more successes to find and N-1 more trials. If we weren't successful (1-p), we have X more successes to find and N-1 more trials. There are also base cases that I left out where X=0 (probability is 1 because we've gotten all the successes) and N less than X (probability is zero because we have no more trials)
The recursion is really killing the speed of computation, so I'm looking for a closed form or approximation or just a point in the right direction.
Thanks