Why isn't Fibonacci of 3 = 3 since (3-1) + (3-2) =2 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Why isn't Fibonacci of 3 = 3 since (3-1) + (3-2) =2

.

13th Feb 2020, 9:05 AM
Kondwani Mwape
Kondwani Mwape - avatar
13 Answers
+ 3
Maybe the confusion comes from some people starting the sequence at 0 and others starting it at 1?
14th Feb 2020, 12:58 AM
Sonic
Sonic - avatar
+ 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.
14th Feb 2020, 10:32 AM
LastSecond959
LastSecond959 - avatar
+ 3
LastSecond959 well said.
14th Feb 2020, 7:58 PM
Sonic
Sonic - avatar
+ 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
15th Feb 2020, 8:10 PM
Rick Shiffman
Rick Shiffman - avatar
+ 1
How? bluesea
13th Feb 2020, 9:09 AM
Kondwani Mwape
Kondwani Mwape - avatar
+ 1
I was asking why Fibonacci of 3 isnt equal to 3
13th Feb 2020, 9:11 AM
Kondwani Mwape
Kondwani Mwape - avatar
+ 1
Sorry could you be a little bit more elaborate
13th Feb 2020, 9:18 AM
Kondwani Mwape
Kondwani Mwape - avatar
+ 1
Which is 3 right? But its supposed to be 2
13th Feb 2020, 9:24 AM
Kondwani Mwape
Kondwani Mwape - avatar
+ 1
Thank you
13th Feb 2020, 9:44 AM
Kondwani Mwape
Kondwani Mwape - avatar
0
Because (3-1)+(3-2)= 3
13th Feb 2020, 9:11 AM
Kondwani Mwape
Kondwani Mwape - avatar
0
hOw can i got points plz tell me LastSecond959 I DONT KNO WHO ARE U BUT HELP ME
14th Feb 2020, 8:49 PM
Krishna Saxena
Krishna Saxena - avatar
0
Krishna Saxena Umm, what points?
15th Feb 2020, 9:37 AM
LastSecond959
LastSecond959 - avatar
- 1
Kgg
14th Feb 2020, 5:16 PM
aakash kushwaha
aakash kushwaha - avatar