x.pl 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. # Conjecture: all terms have the form n*(usigma(n)-1) where usigma(n)-1 is prime.
  7. # The conjecture was inspired by the similar conjecture of Chai Wah Wu from A247077.
  8. use utf8;
  9. use 5.020;
  10. use strict;
  11. use warnings;
  12. use ntheory qw(:all);
  13. use List::Util qw(uniq);
  14. use experimental qw(signatures);
  15. sub inverse_usigma ($n) {
  16. my %r = (1 => [1]);
  17. foreach my $d (divisors($n)) {
  18. my $D = subint($d, 1);
  19. is_prime_power($D) || next;
  20. my %temp;
  21. foreach my $f (divisors(divint($n, $d))) {
  22. if (exists $r{$f}) {
  23. push @{$temp{mulint($f, $d)}}, map { mulint($D, $_) }
  24. grep { gcd($D, $_) == 1 } @{$r{$f}};
  25. }
  26. }
  27. while (my ($key, $value) = each(%temp)) {
  28. push @{$r{$key}}, @$value;
  29. }
  30. }
  31. return if not exists $r{$n};
  32. return sort { $a <=> $b } @{$r{$n}};
  33. }
  34. sub usigma {
  35. vecprod(map { powint($_->[0], $_->[1]) + 1 } factor_exp($_[0]));
  36. }
  37. my $count = 0;
  38. forprimes {
  39. my $p = 2*$_ + 1;
  40. if (is_prime($p)) {
  41. foreach my $k (inverse_usigma($p + 1)) {
  42. #~ is_smooth($n, 20) || next;
  43. #~ $n >= 1e7 or next;
  44. next if ($p == $k);
  45. my $m = mulint($p, $k);
  46. my $o = prime_omega($k) + 1;
  47. if (++$count >= 100000) {
  48. say "Testing: $p -> $k -> $m";
  49. $count = 0;
  50. }
  51. if (modint(mulint($m, ((1 << $o) - 1)), mulint(usigma($k), $p+1) - 1) == 0) {
  52. say "\tFound: $k -> $m";
  53. }
  54. }
  55. }
  56. } 5685054143, 1e10;
  57. # Testing: 2561440319 -> 1207145418 -> 3092030944561308342
  58. # Testing: 11370108287 -> 9939743093 -> 113015955312370311691
  59. # From: 257223167
  60. # From: 3488210431
  61. __END__
  62. Found: 12 -> 228
  63. Found: 35 -> 1645
  64. Found: 75 -> 7725
  65. Found: 231 -> 88473
  66. Found: 108558 -> 20295895122
  67. Found: 120620 -> 22550994580