use Data::Dumper; use strict; use warnings; print time(), "\n"; my @primes; my $candidate = 2; while ($#primes < $ARGV[0] - 1) { my $found = 0; while (!$found) { for my $prime (@primes) { if (!($candidate % $prime)) { $found = 1; last; } } if (!$found) { push @primes, $candidate; } $candidate ++; } } print $primes[-1], "\n"; print time(), "\n";