- or download this
sub factorial_gosper {
# sqrt(2*n*PI + 1/3)*n**n/exp(n)
my $n = shift;
return exp($n*log($n) - $n + 0.5*log(2*$n*PI + 1.0/3.0));
}
- or download this
#!/usr/bin/perl -w
use strict;
...
return exp($n*log($n) - $n + 0.5*log(2*$n*PI + 1.0/3.0));
}
- or download this
PURE : 40320
STIRLING : 417351.253768542
REAL : 39902.3954526567
GOSPER : 40034.4823215513