lucas-fermat_conjecture_cached.pl 810 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/perl
  2. # It is not known whether any Lucas–Carmichael number is also a Fermat pseudoprime to base-2.
  3. # See also:
  4. # https://oeis.org/A006972
  5. # https://en.wikipedia.org/wiki/Lucas%E2%80%93Carmichael_number
  6. use 5.020;
  7. use strict;
  8. use warnings;
  9. use experimental qw(signatures);
  10. use Storable;
  11. use Math::GMPz;
  12. use ntheory qw(:all);
  13. use Math::Prime::Util::GMP;
  14. use experimental qw(signatures);
  15. my $fermat_file = "cache/factors-fermat.storable";
  16. my $lucas_carmichael_file = "cache/factors-lucas-carmichael.storable";
  17. my $fermat = retrieve($fermat_file);
  18. my $lucas_carmichael = retrieve($lucas_carmichael_file);
  19. foreach my $key (keys %$lucas_carmichael) {
  20. if (exists $fermat->{$key}) {
  21. die "Found counter-example: $key";
  22. }
  23. }
  24. say "No counter-example found...";