Skip to content

Instantly share code, notes, and snippets.

@dan-manges
Created June 9, 2010 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dan-manges/431922 to your computer and use it in GitHub Desktop.
Save dan-manges/431922 to your computer and use it in GitHub Desktop.
def fib(n)
if n <= 2
1
else
fib(n-1) + fib(n-2)
end
end
def fibsum(n)
sum = 0
1.upto(n) do |i|
sum += fib(i)
end
sum
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment