Pages

Thursday, December 24, 2015

JS: Fibonacci sequence

The first 21 Fibonacci numbers Fn for n = 0, 1, 2, ..., 20 are: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765.

The sequence can also be extended to negative index n using the re-arranged recurrence relation

Fn-2 = Fn - Fn-1

So here is a sample program to generate Fibonacci series or sequence.
 

No comments:

Post a Comment