prog.sf 874 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/ruby
  2. # Index of smallest Fibonacci number with n prime factors when counted with multiplicity.
  3. # https://oeis.org/A072396
  4. # Known terms:
  5. # 3, 8, 6, 20, 18, 12, 30, 54, 24, 36, 138, 48, 84, 72, 108, 96, 210, 120, 276, 168, 216, 252, 288, 240, 336, 570, 384, 420, 360, 576, 480, 540, 504, 660, 600, 672, 990, 720, 792, 840, 1152, 1140
  6. # Lower-bounds:
  7. # a(43) > 1452
  8. # 1452 < a(43) <= 1596. a(44) = 1296. a(45) = 1368. a(46) = 1080. a(47) = 1200. a(48) <= 1728.
  9. include("../../../factordb/auto.sf")
  10. func a(n, from=1) {
  11. for k in (from..Inf) {
  12. #k.is_prime && next
  13. var t = fib(k)
  14. say "[#{n},#{k}] Checking: #{t}"
  15. if (try { bigomega(t) == n } catch { t.is_almost_prime(n) }) {
  16. #if (t.is_almost_prime(n)) {
  17. return k
  18. }
  19. }
  20. }
  21. say a(48)
  22. #~ for n in (1..100) {
  23. #~ say "a(#{n}) = #{a(n)}"
  24. #~ }