smooth.pl 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #!/usr/bin/perl
  2. # a(n) is the least integer such that sigma(sigma(k)) >= n*k where sigma is A000203, the sum of divisors.
  3. # https://oeis.org/A327630
  4. # New terms:
  5. # a(23) = 109549440
  6. # a(24) = 438197760
  7. # Upper-bounds for other terms:
  8. # a(25) <= 766846080
  9. # a(26) <= 3834230400
  10. # a(27) <= 9081072000
  11. # a(28) <= 32974381440
  12. # a(29) <= 147516969600
  13. # a(30) <= 880887047040
  14. # a(31) <= 2802822422400
  15. # a(32) <= 14814918518400
  16. # a(33) <= 64464915715200
  17. # a(34) <= 709114072867200
  18. # a(35) <= 9881550651772800
  19. # a(36) <= 76648784785372800
  20. # a(37) <= 2376112328346556800
  21. # See also:
  22. # https://oeis.org/A098221
  23. use 5.020;
  24. use warnings;
  25. use experimental qw(signatures);
  26. use Math::GMPz;
  27. use ntheory qw(:all);
  28. sub check_valuation ($n, $p) {
  29. if ($p == 2) {
  30. return valuation($n, $p) < 10;
  31. }
  32. if ($p == 3) {
  33. return valuation($n, $p) < 4;
  34. }
  35. if ($p == 5) {
  36. return valuation($n, $p) < 4;
  37. }
  38. if ($p == 7) {
  39. return valuation($n, $p) < 3;
  40. }
  41. if ($p == 11) {
  42. return valuation($n, $p) < 3;
  43. }
  44. if ($p == 13) {
  45. return valuation($n, $p) < 2;
  46. }
  47. ($n % $p) != 0;
  48. }
  49. sub smooth_numbers ($limit, $primes) {
  50. my @h = (1);
  51. foreach my $p (@$primes) {
  52. say "Prime: $p";
  53. foreach my $n (@h) {
  54. if ($n * $p <= $limit and check_valuation($n, $p)) {
  55. push @h, $n * $p;
  56. }
  57. }
  58. }
  59. return \@h;
  60. }
  61. my $h = smooth_numbers(10**17, primes(57));
  62. say "\nFound: ", scalar(@$h), " terms";
  63. @$h = sort { $a <=> $b } @$h;
  64. my $n = 20;
  65. foreach my $k (@$h) {
  66. next if ($k < 360360);
  67. while (divisor_sum(divisor_sum($k, 1)) >= $k * $n) {
  68. say "a($n) <= $k";
  69. ++$n;
  70. }
  71. }