I'm doing a task in a subject were fib(0) is defined to = 1. But that can't be right? fib(0) is 0?
Program with fib(0) = 1; spits out fib(4) = 5
Program with fib(0) = 0; spits out fib(3) = 3
What is the correct definition?
I'm doing a task in a subject were fib(0) is defined to = 1. But that can't be right? fib(0) is 0?
Program with fib(0) = 1; spits out fib(4) = 5
Program with fib(0) = 0; spits out fib(3) = 3
What is the correct definition?
My explanation is for programmers who wants to have simple understanding of this series and about zero term
just start with
first term as f(1) = 1
second term as f(2) = f(1)+nothing Available = f(1)+0 = 1+0 =1
third term as f(3) = f(2)+f(1) = 1+1 = 2
it is logical to believe, negative and zero terms are results of the Fibonacci formula using golden ratio
Golden Ratio(GR) value is 1.618034 and formula f(n) = (GR^n - (1-GR)^n))/sqrt(5)
Fibonacci series doesn't start with 0. It starts with 1.
We are getting confused trying to represent a mathematical concept as a computer program. The term "Fib(0)" is the array index that holds the first Fibonacci number which is always 1.
We are asking this question because we have to return something from the program when someone enters 0 as input. What that input essentially means is to generate 0 Fibonacci numbers. So you return a message saying "No Fibonacci numbers generated"