-
-
Save karlbecker/2fbacf806f2116cd66c6 to your computer and use it in GitHub Desktop.
fib
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Write an implementation of the fibonacci function. | |
| The fibonacci function is defined as follows: | |
| It is a function that takes one parameter, n | |
| and returns the nth number in the fibonacci sequence. | |
| The fibonacci sequence is the sequence of numbers, | |
| beginning with zero and then one, where all succeeding | |
| numbers in the sequence are the sum of the previous two | |
| numbers. | |
| i.e.: | |
| n fib(n) | |
| 0 0 as defined | |
| 1 1 as defined | |
| 2 1 = 0 + 1 | |
| 3 2 = 1 + 1 | |
| 4 3 = 1 + 2 | |
| 5 5 = 2 + 3 | |
| 6 8 = 3 + 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment