Created
October 27, 2011 09:26
-
-
Save haileys/1319153 to your computer and use it in GitHub Desktop.
This file contains 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
(n -> | |
1 => a | |
0 => b | |
for 1 n ( | |
b => c | |
a => b | |
+ a c => a | |
) | |
a | |
) => fib | |
fib 100000 |
This file contains 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
def fib(n) | |
a = 1 | |
b = 0 | |
n.times do | |
c = b | |
b = a | |
a += c | |
end | |
a | |
end | |
fib 100000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment