0
$\begingroup$

Probability of getting Head = Probability of getting Tail = 1/2. This is basically programming question for large values of N and K (of range 10^5). I know the answer would be equal to (NCK + NC(K+1) + .. + NCN)/(2^N). But how do I calculate it for large values of N and K?

  • 2
    Use the normal distribution with parameters $E=np$ and $\sigma=\sqrt{np(1-p)}$. Especially in the case $p=\frac{1}{2}$ you get very good approximations.2017-02-08
  • 0
    Can you please give any relevant link or describe more. I seem to be unfamiliar with the term normal distribution2017-02-08
  • 0
    Wikipedia often helps to get into a new subject. Look here : https://en.wikipedia.org/wiki/Normal_distribution2017-02-08
  • 0
    It's also possible to use some programming tricks to compute the "exact" answer, if you're willing to do something on the order of $10^5$ multiplications and divisions. The main trick is not to overflow your numeric type. A secondary trick is not to truncate the series prematurely due to limited precision. But that seems like a question for StackOverflow--do you want to migrate the question there?2017-02-08
  • 0
    @DavidK yes, I am looking for some programming trick. How do I migrate the question there?2017-02-08
  • 0
    @Mike The trick is to use a recursion formula to avoid having to compute binomial coefficients which are far too large. Google for binomial distribution. Wikipedia surely mentions such a recursion.2017-02-08
  • 0
    I think you can flag the question. The "close" option leads to a migration option that seems to allow only meta.MSE, stats.SE, or physics.SE as destinations, none of which seem suitable at all, so you would need to select "in need of moderator intervention" and explain what you want.2017-02-08
  • 0
    Related: http://math.stackexchange.com/questions/2135431/how-to-calculate-the-summation-sum-p-kn-binomnp-2n-quickly2017-02-09
  • 0
    OK, I guess we've decided we can handle this here and not bother stackoverflow. But the linked question really _is_ the same question, and it has answers, so let's consider this one a duplicate. It really was a good question, that's why someone else also asked it!2017-02-10

0 Answers 0