inverse_sigma.sf 684 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/ruby
  2. # Least k such that k is the product of n distinct primes and sigma(k) is an n-th power.
  3. # https://oeis.org/A281140
  4. # a(14) <= 94467020965716904490370
  5. func a(n) {
  6. for k in (2..1e9) {
  7. k.is_smooth(3) || next;
  8. inverse_sigma_len(k**n) <= 2e6 || next
  9. inverse_sigma(k**n).each {|v|
  10. if (v.is_squarefree && v.is_almost_prime(n)) {
  11. return v
  12. }
  13. }
  14. }
  15. }
  16. for n in (1..20) {
  17. say [n, a(n)]
  18. }
  19. __END__
  20. [1, 2]
  21. [2, 22]
  22. [3, 102]
  23. [4, 510]
  24. [5, 90510]
  25. [6, 995610]
  26. [7, 11616990]
  27. [8, 130258590]
  28. [9, 1483974030]
  29. [10, 18404105922510]
  30. [11, 428454465915630]
  31. [12, 10195374973815570]
  32. [13, 240871269907008510]