carmichael_is_fibonacci_cached.pl 645 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/perl
  2. # Is there a Fibonacci Number that is also a Carmichael Number?
  3. # Problem from:
  4. # https://math.stackexchange.com/questions/4827535/is-there-a-fibonacci-number-that-is-also-a-carmichael-number
  5. use 5.020;
  6. use strict;
  7. use warnings;
  8. use Storable;
  9. use Math::GMPz;
  10. use ntheory qw(:all);
  11. use Math::Sidef qw(is_fibonacci);
  12. #use Math::Prime::Util::GMP;
  13. use experimental qw(signatures);
  14. my $carmichael_file = "cache/factors-carmichael.storable";
  15. my $carmichael = retrieve($carmichael_file);
  16. while(my($key, $value) = each %$carmichael) {
  17. if (is_fibonacci($key)) {
  18. say $key;
  19. }
  20. }
  21. __END__
  22. No such number is known...