Skip to content

Instantly share code, notes, and snippets.

@haileys
Created October 27, 2011 09:26
Show Gist options
  • Save haileys/1319153 to your computer and use it in GitHub Desktop.
Save haileys/1319153 to your computer and use it in GitHub Desktop.
(n ->
1 => a
0 => b
for 1 n (
b => c
a => b
+ a c => a
)
a
) => fib
fib 100000
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