almost-extra-strong-lucas_not_extra-strong-lucas.pl 973 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/perl
  2. # Find almost-extra-strong Lucas pseudoprimes that are not extra-strong Lucas pseudoprimes.
  3. # The first few terms, are:
  4. # 10469, 154697, 233659, 472453, 629693, 852389, 1091093, 1560437, 1620673, 1813601, 1969109, 2415739, 2595329, 2756837, 3721549, 4269341, 5192309, 7045433, 7226669, 7265561, 9081929, 9826289, 10176893, 11436829, 11855969
  5. use 5.020;
  6. use strict;
  7. use warnings;
  8. use Math::Prime::Util::GMP qw(
  9. is_pseudoprime
  10. is_lucas_pseudoprime
  11. is_extra_strong_lucas_pseudoprime
  12. is_almost_extra_strong_lucas_pseudoprime
  13. );
  14. while (<>) {
  15. next if /^\h*#/;
  16. /\S/ or next;
  17. my $n = (split(' ', $_))[-1];
  18. $n || next;
  19. next if ($n < 1e14);
  20. #next if length($n) > 40;
  21. is_pseudoprime($n, 2) && next;
  22. if (is_almost_extra_strong_lucas_pseudoprime($n)
  23. and not is_extra_strong_lucas_pseudoprime($n)) {
  24. say $n;
  25. }
  26. }
  27. __END__
  28. # Some larger terms:
  29. 101379108770549
  30. 546532586280913937
  31. 1643850930720414293