Skip to content

Instantly share code, notes, and snippets.

@markrickert
Created March 13, 2013 00:04
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 markrickert/5148247 to your computer and use it in GitHub Desktop.
Save markrickert/5148247 to your computer and use it in GitHub Desktop.
Fibonacci Sequence
# Find the fibonacci sequence of the position n
def fib (n)
return n if [0,1].include?(n)
fib(n-1) + fib(n-2)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment