chickadee » chalk » fibonacci

fibonacci nprocedure

Computes the nth Fibonacci. This naïve algorithm runs in O(2^n); using e.g. memoization, we could bring it down to O(n).

n
The nth number to calculate

For example, computing the 6th Fibonnaci number (starting from 0)

(fibonacci 6) ; => 8