Probability / Permutation of large number of events. This seems like a very silly and simple question, but I'm here to learn. So here it is:

How can I compute the probability of getting heads x times when tossing a coin a large number of times?  For example, what is the probability of getting heads 181 times when tossing a coin 300 times?

I understand how to do this using permutations, factorials, and traditional (elementary) probability methods. My problem is that my calculator won't go that high. I'm unable to use (300!)/[(181!)(119!)] because I get an overflow error.

The question I'm solving doesn't specifically ask for the probability, but I'd like to learn. Thanks!
In your case we have $\binom{300}{181}\cdot2^{-181}\cdot2^{-(300-181)} = \binom{300}{181}\cdot2^{-300}$ as the correct formula, where we need to compute $\binom{300}{181} = \frac{300!}{181!\cdot119!}$.

How do you compute such large binomials? You can use the following formula:

$$\binom{n}{k} = \prod_{i=1}^k \frac{n+1-i}{i}$$

Since $n$ and $i$ are on the same order all terms stay manageable. To keep the product managable as a whole you can repeatedly halve the partial product until it gets below 1, keeping count of how many halvings you did, making sure never to do more than $300$, as well as however many are left to do at the end to finish the multiplication by $2^{-300}$.

All in all it would be a couple hundred steps, cumbersome to do by hand, but trivial for a computer.
This is just a summary of comments, below, so that the OP can vote on it.



If you're going to use a computer, as orlp suggests, the approach is trivial:

In Mathematica:

Binomial[300, 181] (1/2)^300


$\frac{11795883462622100885471935681885637931873470140170002831274647962254384085185135026
   25}{1591434356511317254897223194069826688321459682551512695809484726058110390440106801
   7057792} \approx 0.0000741211$

This approach can be used on any computer through WolframAlpha, and will yield as many digits as you could ever need.  Even the "hard" problem ("the probability of hitting exactly 234658 heads out of 1259923") posed by orlp is given to arbitrary number of digits quickly without the need to write iterative code or confronting other problems...

And since you also want to know the probability of getting at least $180$, well again this is trivial:

Sum[Binomial[300, i] (1/2)^300, {i, 180, 300}]


$\frac{40372780344505313991018191943947190320930407268761546691659955107726023855608420480
   429}{127314748520905380391777855525586135065716774604121015664758778084648831235208544
   136462336} \approx 0.00031711$,

which can be accessed on WolframAlpha instantly.

(I don't know how one would ever answer this ancillary question using a hand calculator and the methods suggested by orlp, but am eager to hear suggestions.)