I already made a code that finds the nth term of a Fibonacci sequence (Fn) using a recursive function but I need help updating this code to also output how many times the recursive sequence ran.
As of right now, the code I have to find the nth term is: (where n=2 and n=1 are the base conditions that tells the recursive function to stop)
function[F_n] = Fibonacci(n) if n == 2 F_n = 1; elseif n == 1 F_n = 0; else F_n = Fibonacci(n-1) + Fibonacci(n-2); endend
Best Answer