"Generate the nth Fibonacci number."?

'The nth Fibonacci number'. Is it the actual '9th' number(55) or the sum of the ninth Fibonacci sequence(144)? Fiddling around with Rust in Emacs,today. Rust Book suggests 'tasks' to accomplish. Came across this in a tutorial vid. Having a lot of fun.

Bold choice for a coding font :laughing:

Regarding the question which one exactly the "ninth" Fibonacci number is, that might be just a matter of convention. Usually people start the Fibonacci numbers either 1, 1, 2, 3, 5, 8, ... or 0, 1, 1, 2, 3, 5, .... However, when starting with 0, you could also give the initial 0 the index 0; i.e. you could generally define for indices i the number Fi so that

F0 = 0
F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
F7 = 13
F8 = 21
F9 = 34
...and so on

but then again, we could discuss whether to call F0 the "first" Fibonacci number or the "zeroth" Fibonacchi number (which matters for the ninth one, too, if you count further up). Talking about zero-based indexing in plain English really is not trivial. In conclusion, when asking for ninth Fibonacci number, you would most commonly either be referring to F9 = 34, or possibly to F8 = 21.


Side note: A good reason for choosing the indices F0, F1, etc.. precisely the way it's done above is that this convention allows for a clean general closed-form formula

93dccb9c257e4c9f677b776009f188d8

Edit: Formula in grey supports light theme and dark theme :slight_smile:

6 Likes

You want the numbering where F0 is 0; there are many other formulas involving Fibonacci numbers such as "Fkn is a multiple of Fn" that rely on it.

3 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.