Find file
Fetching contributors…
Cannot retrieve contributors at this time
19 lines (16 sloc) 339 Bytes
my sub next-prime(*@primes) {
my $i = @primes[*-1];
return 3 if $i == 2;
loop {
$i += 2;
my $prime = True;
for @primes {
if $i %% $_ {
$prime = False;
last;
}
}
return $i if $prime;
}
}
say (2, 3, &next-prime ... 2357).perl;