prog.sf 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/ruby
  2. # a(n) is the least k such that sigma(k) is a Fibonacci number when k is the product of n distinct primes, or 0 if no such k exists.
  3. # https://oeis.org/A290936
  4. # Known terms:
  5. # 2, 94, 66, 19290, 2000006490, 247917529768610, 276320525457530886869600795810
  6. # a(7) > 1709943212167773357407100
  7. # a(7) = 276320525457530886869600795810
  8. # Lower-bounds:
  9. # sigma(a(8)) >= fibonacci(240)
  10. func a(n, from=1) {
  11. for k in (from..Inf) {
  12. say "[#{n}] Checking k = #{k}"
  13. var arr = k.fib.inverse_sigma
  14. with (arr.first_by { .is_squarefree_almost_prime(n) }) {|v|
  15. return v
  16. }
  17. }
  18. }
  19. var n = 8
  20. var from = 240 # requires more than 6GB of RAM
  21. say "a(#{n}) = #{a(n, from)}"
  22. #~ for n in (8) {
  23. #~ var v = a(n)
  24. #~ say "#{n} #{v}"
  25. #~ }
  26. __END__
  27. 1 2
  28. 2 94
  29. 3 66
  30. 4 19290
  31. 5 2000006490
  32. 6 247917529768610
  33. 7 276320525457530886869600795810
  34. [7, 276320525457530886869600795810]
  35. [7, 277036896340045639450458794690]
  36. [7, 278062077795208406914509455810]
  37. [7, 278069492041326495002531471810]
  38. [7, 283788647210397460193342594210]
  39. [7, 284516793112050600413768772290]
  40. [7, 285577268526665078125073654210]