We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

# Fibonacci Numbers

# Fibonacci Numbers

+ 0 comments F# solution

open System let rec f n = match n with | 1 -> 0 | 2 -> 1 | n -> f (n - 1) + f (n - 2) [<EntryPoint>] let main argv = Console.ReadLine() |> int |> f |> Console.WriteLine 0

+ 0 comments This is a great source here.

+ 0 comments I am a new learner here , can you help me.

+ 0 comments Simple Haskell solutionfibs = 0 : 1 : [ a + b | (a, b) <- zip fibs (tail fibs)] fib n = last $ take n fibs

+ 0 comments That's a simple haskell solution which matches the fibonacci formula:

fib(n) Sequence Nth: 1 2 3 4 5 6 7 08 09 10 11 12 [...] Terms: 0 1 1 2 3 5 8 13 21 34 55 89 [...] fib 1 = 0 fib 2 = 1 fib n = fib(n-1) + fib(n-2)

Load more conversations

Sort 55 Discussions, By:

Please Login in order to post a comment