3 ms·
It's definitely wrong - just ran it in python to check in case I was missing something!
by amouat 16y ago
It's definitely wrong - just ran it in python to check in case I was missing something!
- deleted 16y ago[deleted]
- jpd 16y agoI don't think it's explicitly wrong; I've seen both fib(0) = 1 and fib(0) = 0 before. Wikipedia shows: By definition, the first two Fibonacci numbers are 0 and 1, and each subsequent number is the sum of the previous two. Some sources omit the initial 0, instead beginning the sequence with two 1s.
- amouat 16y agoI think it's still wrong by that definition. I think it is just saying fib(1) is the first number, not fib(0). fib(2) should never be 2. EDIT: Actually, I think you're right: it's just an index thing (do we start at 1 or 0) - I was confusing the index of 2 with the value of 2.