B. Rothstein wrote:
>
> Does anyone have any suggestions on how to create an array to hold the value
> of 1000 factorial?
Hi.
Use Math::BigInt. The program below stores the first 1000 factorials into an
array and prints out the thousandth, which is 2568 digits long. It also runs
incredibly quickly - under a second on my machine.
HTH,
Rob
use strict;
use warnings;
use Math::BigInt;
my $n = new Math::BigInt 1;
my @f = $n; # Initialize factorial zero
for my $i (1 .. 1000) {
push @f, $n *= $i;
}
print $f[1000], "\n";
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]