upper-bounds.sf 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/ruby
  2. # Smallest number m such that sigma(m) has exactly n distinct prime factors.
  3. # https://oeis.org/A152562
  4. # Known terms:
  5. # 2, 5, 20, 104, 936, 13842, 188424, 3249576, 81239400, 2388809736, 59720243400
  6. # Upper-bounds:
  7. # a(12) <= 2571228006912
  8. # a(13) <= 85266458294400
  9. # a(14) <= 4638227848902900
  10. # a(15) <= 209103527633041800
  11. # a(16) <= 10931190635671518600
  12. # a(17) <= 545209768960172964900
  13. # a(18) <= 34893425213451069753600
  14. # a(19) <= 2000640771807316185690000
  15. # a(n) <= A153076(n). - ~~~~
  16. # Cf. A153076.
  17. func upper_bound(n, from = 2, upto = 2*from) {
  18. say "\n:: Searching an upper-bound for a(#{n})\n"
  19. var min = Inf
  20. loop {
  21. var count = n.squarefree_almost_prime_count(from, upto)
  22. if (count > 0) {
  23. say "Sieving range: [#{from}, #{upto}]"
  24. say "This range contains: #{count.commify} elements\n"
  25. n.squarefree_almost_primes_each(from, upto, {|v|
  26. var t = v.inverse_sigma_min
  27. if (t && (t < min)) {
  28. min = t
  29. say "a(#{n}) <= #{min}"
  30. }
  31. })
  32. }
  33. from = upto+1
  34. upto *= 2
  35. }
  36. }
  37. upper_bound(20)