The Fibonacci sequence
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 ...
is defined by the formula Fn = Fn-1 + Fn-2 for n ≥ 2 with F0 = 0 and F1 = 1. The Fibonacci numbers have many
interesting properties and arise in numerous applications. For example, certain
rhythmic pieces of music for the Indian instrument known as the tabla come in
short strokes (1 beat) and long strokes (2 beats). How many difference ways can
you fill up 8 beats with short and long strokes? The answer is the 34 (the
8+1st Fibonacci number).
You have to fill in the fib method to recursively
return the nth fibonacci number.
0 comments:
Post a Comment