I want to calculate the quotients of a Fibonacci series, such that:
I have created a function to calculate the Fbonacci series, and is ok, but i'm having troubles calculating the quotients. This is my function:
fibonacci <- function(n){
numbers <- numeric(n)
numbers[1] <- 1
numbers[2] <- 1
for (i in 3:n)
numbers[i] <- numbers[i-1]+numbers[i-2]
return(numbers)
}
This will calculate the Fibonacci sequence. This is what i have tried to calculate the quotients:
fibonacci_q <- function(n){
numbers <- numeric(n)
numbers[1] <- 1
numbers[2] <- 1
for (i in 3:n)
numbers[i] <- numbers[i-1]+numbers[i-2]
return(numbers/numbers[i-1])
}
This not working properly, it returns really small numbers, and i'm not getting the same results displayed in the table above. Can someone explain me what i'm i doing wrong and how to fix it please?
Thank you very much in advance