resta_form.sf 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/ruby
  2. # Integers k such that k is equal to the sum of the nonprime proper divisors of k.
  3. # https://oeis.org/A331805
  4. # 9*10^12 < a(4) <= 72872313094554244192 = 2^5 * 109 * 151 * 65837 * 2101546957. - Giovanni Resta, Jan 28 2020
  5. # Notice that:
  6. # 65837 = 2^2 * 109 * 151 + 1
  7. # sigma(2^5 * 109 * 151 * 65837) / 2101546957 =~ 33.00003145254488 =~ 2^5 + 1
  8. # Also:
  9. # log_3(72872313094554244192) =~ 41.6300098 (coincidence?)
  10. func isok(n) {
  11. n.sigma - n - n.prime_sigma == n
  12. }
  13. primes(200).combinations(2, {|a,b|
  14. for k in (1..10) {
  15. var t = (2**k * a * b + 1)
  16. t.is_prime || next
  17. #valuation(a+1, 2) + valuation(b+1, 2) + valuation(t+1, 2) == (2*k + 1) || next
  18. for j in (k .. (2*k + 1)) {
  19. var v = (2**j * t * a * b)
  20. var s = v.sigma
  21. (s/v < 2) && (s/v > (2 - 1/v.pow(2/3))) || next
  22. say "#{[v, k, j]} with #{s/v}"
  23. for p in (factor(s - (2 + t + a + b))) {
  24. var u = (v * p)
  25. if (u > 1e13 && isok(u)) {
  26. say "Found: #{u}"
  27. }
  28. }
  29. }
  30. }
  31. })
  32. __END__
  33. [18632, 2, 2] with 1.99978531558608844997853155860884499785315586088
  34. [1292768, 2, 4] with 1.99998762345602613926087279388103665932325057551
  35. [391612, 1, 2] with 1.99997957161680438801671041745401060233087852262
  36. [6800695312, 3, 4] with 1.99999999882364969565923702714473263847936377009
  37. [34675557856, 2, 5] with 1.99999999907715976386338198209606332569567067674
  38. Found: 72872313094554244192