other_bases.pl 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/usr/bin/perl
  2. # Poulet numbers (Fermat pseudoprimes to base 2) that are congruent to {3,27} mod 80 and each prime factor is congruent to 3 mod 80.
  3. # 51962615262396907, 330468624532072027, 2255490055253468347, 18436227497407654507
  4. # If a term of this sequence is also a Carmichael number (A002997) and a Lucas-Carmichael number (A006972), then it would be a counterexample to Agrawal's conjecture, as Lenstra and Pomerance showed.
  5. # 330468624532072027 is the only Carmichael number bellow 2^64 that is a term of this sequence.
  6. # The sequence also includes: 68435117188079800987, 164853581396047908970027, 522925572082528736632187, 1820034970687975620484907, 4263739170243679206753787, 4360728281510798266333387, 28541906071781213329174507, 33833150661360980271172507, 84444874320158644422192427, 175352076630428496579381067, 270136290676063386556053067, 615437738523352001584590187, 3408560627000081376639770587, 11260257876970792445537580187.
  7. # Are all terms also strong pseudoprimes to base 2 (A001262)?
  8. # (PARI) isok(n) = ((n%80==3) || (n%80==27)) && (Mod(2, n)^(n-1) == 1) || return(0); my(f=factor(n)[,1]); #f > 1 && #select(p->p%80==3, f) == #f;
  9. # Agrawal's Conjecture and Carmichael Numbers
  10. use 5.020;
  11. use warnings;
  12. use experimental qw(signatures);
  13. use List::Util qw(shuffle);
  14. use ntheory qw(forcomb forprimes kronecker divisors lucas_sequence factor_exp factor primes divisor_sum powmod);
  15. use Math::Prime::Util::GMP qw(is_frobenius_pseudoprime vecprod binomial is_pseudoprime);
  16. my %common_divisors;
  17. forprimes {
  18. if (($_ % 80 == 3) ) {
  19. foreach my $d (divisors($_ - 1)) {
  20. #next if ($d+1 == $_);
  21. next if ($d <= 7);
  22. if (powmod(2, $d, $_) == 1 or powmod(3, $d, $_) == 1 or powmod(5, $d, $_) == 1 or powmod(7, $d, $_) == 1 or powmod(11, $d, $_) == 1) {
  23. push @{$common_divisors{$d}}, $_;
  24. }
  25. }
  26. }
  27. } 1e9;
  28. foreach my $arr (values %common_divisors) {
  29. my @nums = @$arr;
  30. next if (@nums < 3);
  31. for my $k(3..scalar(@nums)) {
  32. #next if ($k % 2 == 0);
  33. forcomb {
  34. my $n = vecprod(@nums[@_]);
  35. # if ($n > ~0) {
  36. if (is_pseudoprime($n, 2) or is_pseudoprime($n, 3) or is_pseudoprime($n, 5) or is_pseudoprime($n, 7) or is_pseudoprime($n, 11)) {
  37. say $n;
  38. }
  39. # }
  40. } scalar(@nums), $k;
  41. }
  42. }
  43. __END__
  44. Lenstra, H. W.; Pomerance, Carl (2003), <a href="http://www.aimath.org/WWN/primesinp/primesinp.pdf">Remarks on Agrawal's conjecture</a>, American Institute of Mathematics (2003), pp. 30-32.
  45. Tomáš Váňa, <a href="http://web.ics.upjs.sk/svoc2009/prace/7/Vana.pdf">Agrawal's Conjecture and Carmichael Numbers</a>, student scientific conference, pp. 13-22.
  46. Wikipedia, <a href="https://en.wikipedia.org/wiki/Agrawal%27s_conjecture">Agrawal's conjecture</a>
  47. If a term of this sequence is also a Carmichael number (A002997) and a Lucas-Carmichael number (A006972), then it would be a counterexample to Agrawal's conjecture, as Lenstra, H. W. and Carl Pomerance showed.
  48. 330468624532072027 is the only Carmichael number bellow 2^64 that is a term of this sequence. However, it is not a Lucas-Carmichael number.
  49. The sequence also includes: 68435117188079800987, 164853581396047908970027, 522925572082528736632187, 1820034970687975620484907, 4263739170243679206753787, 4360728281510798266333387, 28541906071781213329174507, 33833150661360980271172507, 84444874320158644422192427, 175352076630428496579381067, 270136290676063386556053067, 615437738523352001584590187, 3408560627000081376639770587, 11260257876970792445537580187.
  50. No term with 5 prime factors (which would be congruent to 3 mod 80) is known to the author.
  51. Are all terms also strong pseudoprimes to base 2 (A001262)?
  52. Lenstra, H. W.; Pomerance, Carl (2003), <a href="http://www.aimath.org/WWN/primesinp/primesinp.pdf">Remarks on Agrawal's conjecture</a>, American Institute of Mathematics (2003), pp. 30-32.
  53. Tomáš Váňa, <a href="http://web.ics.upjs.sk/svoc2009/prace/7/Vana.pdf">Agrawal's Conjecture and Carmichael Numbers</a>, student scientific conference, pp. 13-22.
  54. Wikipedia, <a href="https://en.wikipedia.org/wiki/Agrawal%27s_conjecture">Agrawal's conjecture</a>