is_frobenius_pseudoprime.pl 467 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/perl
  2. # Try to find a Frobenius pseudoprime to the Frobenius primality test.
  3. use 5.020;
  4. use strict;
  5. use warnings;
  6. use experimental qw(signatures);
  7. use Math::Prime::Util::GMP qw(is_frobenius_pseudoprime);
  8. while (<>) {
  9. next if /^\h*#/;
  10. /\S/ or next;
  11. my $n = (split(' ', $_))[-1];
  12. $n || next;
  13. next if $n < ~0;
  14. if (is_frobenius_pseudoprime($n)) {
  15. die "\nCounter-example: $n\n";
  16. }
  17. }
  18. say "No counter-example found...";