Skip to content

Instantly share code, notes, and snippets.

@jayshenk
Created April 2, 2016 18:57
Show Gist options
  • Save jayshenk/a6774299581caebcb523884d2e2fee25 to your computer and use it in GitHub Desktop.
Save jayshenk/a6774299581caebcb523884d2e2fee25 to your computer and use it in GitHub Desktop.
class Fibonacci
def self.nth(number)
fibo = [1, 1]
while fibo.size < number
fibo << fibo[-2] + fibo[-1]
end
fibo.last
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment