How can I compute the probability that each set of n flips resulted in the same number of heads?
I've spent the last hour coming up with the general formula below. My primary question is: how would I compute the result for say, n = 10000? (As a last resort I could write C++ logic to compute the formula, but I imagine there's an easier free math tool out there).
Also, I do wonder if the general formula is correct.
So, for flips, with a probability of landing heads each flip.
If the general formula is well known or you could provide a link to it, I'd appreciate that.
Short explanation of how I came up with it: The part calculates the binomial coefficient. So, if you flipped a coin 3 times, there are 3 ways it to get one head. That is multiplied by the probability of getting n-k heads and k tails.
Finally, I want to know the chance that n-k heads occurred in each set of flips, so I square it, then sum the whole thing from k=1 to n. The leading is there because the multiplicative binomial formula (the part) does not work when k = 0.