In the Fibonacci sequence, is fib(0) 0 or 1 ?

fibonacci

Solution

You're correct. The Fibonacci sequence is formally defined with seed values `fib(0) = 0` and `fib(1) = 1`. This is a requirement for the rest of the sequence to be right (and not offset by one or anything).

In mathematics, the Fibonacci numbers, commonly denoted F_n, form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1.

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.

Edit: I have to concede that there is another (much less common, and usually informal) way to define the sequence by seeding it with values 1 and 1, but this is not the conventional one by any means. It is certainly not preferred in all the formal mathematical definitions I’ve seen, like The On-Line Encyclopaedia of Integer Sequences.

Problem

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?

Original source