fibonacci series


See On Github

Data

Contributor

Generic placeholder thumbnail

by jcla1

in haskell

Tags

recursion

Source Code

-- This simply expresses the recurrence
-- relation of the fibonacci series. I
-- would not recommend using it in production
-- since it uses O(fib(n)) additions to calculate
-- the nth fibonacci term
fib 0 = 0
fib 1 = 1
fib n = fib (n-1) + fib (n-2)