Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 20 lines (15 sloc) 481 Bytes
#!/usr/bin/env perl
use strict;
use warnings;
use lib 'lib';
use Math::Primality qw/is_strong_pseudoprime is_prime/;
$|++;
# PODNAME: strong_pseudoprimes.pl
# ABSTRACT: Print all strong pseudoprimes between two integers
my ($base, $start, $end) = @ARGV;
die "USAGE:$0 base start end\n" unless ($base && $start >= 0 && $end > $start);
my $i=$start;
print "Generating spsp($base)\n";
while ( $i++ < $end ){
print "$i\n" if is_strong_pseudoprime($i,$base) && !is_prime($i);
}