|
![](/i/fill.gif) |
Invisible <voi### [at] dev null> writes:
> Pr(402 heads) = (1000 choose 402) / 2^1000
>
> Now this is a problem. 2^1000 is roughly the square of the number of
> atoms in the observable universe, while 1000 choose 402 is defined as
>
> 1000 choose 402 = 1000! / (402! * 598!)
>
> In principle it looks plausible that you could compute the factorial of
> a big number. It might just be a bit slow, eh? Well... no. It turns out
> that 1000! is over 3 million bits in length, for a start.
>
> Even if you could compute 1000 choose 402, it's again almost as huge as
> 2^1000. And taking the quotient of two vast numbers is unlikely to be
> very numerically stable.
Am I missing something? This is trivial to calculate:
(1000/(598*2)) * (999/(597*2) * (998/(596/2)) * ...
when you've exhausted the 598!, continue the sequence with 402!
Post a reply to this message
|
![](/i/fill.gif) |