1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- #!/usr/bin/ruby
- # 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.
- # https://oeis.org/A290936
- # Known terms:
- # 2, 94, 66, 19290, 2000006490, 247917529768610, 276320525457530886869600795810
- # a(7) > 1709943212167773357407100
- # a(7) = 276320525457530886869600795810
- # Lower-bounds:
- # sigma(a(8)) >= fibonacci(240)
- func a(n, from=1) {
- for k in (from..Inf) {
- say "[#{n}] Checking k = #{k}"
- var arr = k.fib.inverse_sigma
- with (arr.first_by { .is_squarefree_almost_prime(n) }) {|v|
- return v
- }
- }
- }
- var n = 8
- var from = 240 # requires more than 6GB of RAM
- say "a(#{n}) = #{a(n, from)}"
- #~ for n in (8) {
- #~ var v = a(n)
- #~ say "#{n} #{v}"
- #~ }
- __END__
- 1 2
- 2 94
- 3 66
- 4 19290
- 5 2000006490
- 6 247917529768610
- 7 276320525457530886869600795810
- [7, 276320525457530886869600795810]
- [7, 277036896340045639450458794690]
- [7, 278062077795208406914509455810]
- [7, 278069492041326495002531471810]
- [7, 283788647210397460193342594210]
- [7, 284516793112050600413768772290]
- [7, 285577268526665078125073654210]
|