@georgiana.senger
To calculate Fibonacci extensions in Ruby, you can use the following steps:
1 2 3 4 5 6 7 |
def fibonacci(n) fib = [0, 1] (2..n).each do |i| fib << fib[i-1] + fib[i-2] end return fib end |
1
|
fib_sequence = fibonacci(10) |
1 2 |
extension = fib_sequence.last * 1.618 puts "1.618 Fibonacci extension: #{extension}" |
By following these steps, you can easily calculate Fibonacci extensions in Ruby.