#!perl use bignum; # This is Stirling's approximation for log(n!), but # without the "-n" piece that cancels out below in any # case. sub xe{ $_[0]*log($_[0])+log(atan2(1,1)*8*$_[0])/2 + 1/(12*$_[0]) - 1/(360*($_[0]**3)) + 1/(1260*($_[0]**5)); } if (!@ARGV) { @ARGV = qw{ 2**96 3*(10**6) 1*(10**6) }; } my($m,$n,$r)=map {eval "use bignum;$_"}@ARGV; my $e=exp(xe($m-$n)+xe($m-$r)-xe($m)-xe($m-$n-$r)); printf "%3.5g %3.5g %3.5g\n",$e,1-$e,(1-"$e");