Campbell Ritchie wrote:... I am also not sure I agree with Salvin about what a Fibonacci series contains. I don't believe there s such a thing as fib(0); the first two element of the series are 1, 1...
I looked up wiki and found this:
Fibonacci_number. They do mention about F
0 as a part of the Fibonacci sequence. Is there any particular reason why it's not a good idea to include 0 or consider 0 as F
0 ?
Here's what wiki mentions:
wiki wrote:In mathematics, the Fibonacci numbers, commonly denoted Fn, form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is,
F0 = 0, F1 = 1
and
Fn = Fn-1 + Fn-2
for n > 1.
The beginning of the sequence is thus: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...
Mui Goku wrote:The return value indicates the indices of the Fibonacci series, for example, if you pass 5 as the value it will return 5 as at index 5 the value is 5, and for value 6 it will return 8
Thanks that clears my question. This means that the input 'n' represents the index of the series. I hope adding loggers clears your original doubt.