smooth_generate.pl 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/usr/bin/perl
  2. # Numbers that are not powers of primes (A024619) whose harmonic mean of their proper unitary divisors is an integer.
  3. # https://oeis.org/A335270
  4. # Known terms:
  5. # 228, 1645, 7725, 88473, 20295895122, 22550994580
  6. # These are numbers m such that omega(m) > 1 and (usigma(m)-1) divides m*(2^omega(m)-1).
  7. # Conjecture: all terms have the form n*(usigma(n)-1) where usigma(n)-1 is prime.
  8. # The conjecture was inspired by the similar conjecture of Chai Wah Wu from A247077.
  9. use 5.020;
  10. use warnings;
  11. use experimental qw(signatures);
  12. use Math::GMPz;
  13. use ntheory qw(:all);
  14. sub check_valuation ($n, $p) {
  15. #~ 1
  16. #~ if ($p == 2) {
  17. #~ return valuation($n, $p) < 5;
  18. #~ }
  19. #~ if ($p == 3) {
  20. #~ return valuation($n, $p) < 3;
  21. #~ }
  22. #~ if ($p == 7) {
  23. #~ return valuation($n, $p) < 3;
  24. #~ }
  25. if ($p <= 13) {
  26. return (valuation($n, $p) < 2);
  27. }
  28. ($n % $p) != 0;
  29. }
  30. sub smooth_numbers ($limit, $primes) {
  31. my @h = (1);
  32. foreach my $p (@$primes) {
  33. say "Prime: $p";
  34. foreach my $n (@h) {
  35. if ($n * $p <= $limit and check_valuation($n, $p)) {
  36. push @h, $n * $p;
  37. }
  38. }
  39. }
  40. return \@h;
  41. }
  42. sub usigma {
  43. vecprod(map { powint($_->[0], $_->[1]) + 1 } factor_exp($_[0]));
  44. }
  45. sub isok ($m) {
  46. modint(mulint($m, ((1 << prime_omega($m)) - 1)), usigma($m) - 1) == 0;
  47. }
  48. my $h = smooth_numbers(1e10, primes(200));
  49. say "\nTotal: ", scalar(@$h), " terms\n";
  50. my %table;
  51. foreach my $n (@$h) {
  52. #$n > 1e7 || next;
  53. my $p = usigma($n) - 1;
  54. is_prime($p) || next;
  55. next if ($n == $p);
  56. my $m = mulint($n, $p);
  57. if (isok($m)) {
  58. say "Found: $n -> $m";
  59. }
  60. }
  61. __END__
  62. Found: 12 -> 228
  63. Found: 75 -> 7725
  64. Found: 35 -> 1645
  65. Found: 231 -> 88473
  66. Found: 108558 -> 20295895122
  67. Found: 120620 -> 22550994580