lucas-carmichael_conjecture_cached.pl 901 B

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