+ 3
Why isn't Fibonacci of 3 = 3 since (3-1) + (3-2) =2
.
13 Antworten
+ 3
Maybe the confusion comes from some people starting the sequence at 0 and others starting it at 1?
+ 3
Sonic Kondwani Mwape There is confusion because some people make a fibo sequence that the first number of it is 1, some of them make the first number 0. It is true that fibonacci starts from 0 and 0 is the first number of the sequence, not 1. That is why in a pseudo-code, the recursion of fibonacci function have a base if n is 0, return 0, else if n is 1 return 1, other than that you do recursive.
What made the confusion is also that when you do fibo (1) for example, it prints out 1 instead of 0, why is that? Because in programming (what I know), is that things starts from 0 like indexes of arrays, you can make your own code looks like if you input 1, it does fibo(input-1) and it will print out 0 instead of 1. I hope this is clear to understand.
+ 3
LastSecond959 well said.
+ 2
if the fibonacci sequence is defined to start at 0, then the sequence is 0,1,1,2,3,5,8,...then fib(0)=0, fib(1)=1, fib(2)=1, fib(3)=2, and fib(4)=3. it all depends on where you start the sequence, if started a 1, instead of 0, then fib(3)=3
+ 1
How? bluesea
+ 1
I was asking why Fibonacci of 3 isnt equal to 3
+ 1
Sorry could you be a little bit more elaborate
+ 1
Which is 3 right? But its supposed to be 2
+ 1
Thank you
0
Because (3-1)+(3-2)= 3
0
hOw can i got points plz tell me LastSecond959 I DONT KNO WHO ARE U BUT HELP ME
0
Krishna Saxena Umm, what points?
- 1
Kgg