prog.sf 966 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/ruby
  2. # a(n) is the index of the smallest Fibonacci n-step number with exactly n prime factors (counted with multiplicity).
  3. # https://oeis.org/A359881
  4. # Known terms:
  5. # 8, 9, 10, 12, 17, 18, 29, 24, 38, 30, 45, 39, 41, 45, 61, 50, 67, 73, 77, 82, 62, 60
  6. # New terms (a(24)-a(64)):
  7. # 8, 9, 10, 12, 17, 18, 29, 24, 38, 30, 45, 39, 41, 45, 61, 50, 67, 73, 77, 82, 62, 60, 71, 70, 127, 161, 112, 111, 86, 154, 91, 127, 99, 100, 141, 109, 109, 115, 159, 122, 122, 125, 131, 133, 134, 329, 138, 147, 196, 407, 150, 256, 320, 165, 163, 223, 170, 173, 174, 179, 243, 184, 317
  8. include("../../../factordb/auto.sf")
  9. func a(n, from=1) {
  10. for k in (from..Inf) {
  11. var t = fib(k,n)
  12. say "[#{n},#{k}] Checking: #{t}"
  13. #if (try { bigomega(t) == n } catch { t.is_almost_prime(n) }) {
  14. if (t.is_almost_prime(n)) {
  15. return k
  16. }
  17. }
  18. }
  19. #say a(50)
  20. say a(64)
  21. #~ for n in (2..100) {
  22. #~ say "a(#{n}) = #{a(n)}"
  23. #~ }