Skip to content

Instantly share code, notes, and snippets.

@sauron
Created December 5, 2013 22:37
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 sauron/7815289 to your computer and use it in GitHub Desktop.
Save sauron/7815289 to your computer and use it in GitHub Desktop.
Fibonacci Loves maths :D
def fibo(n)
root5=Math.sqrt(5)
phi=0.5+(root5/2)
Integer(0.5+phi**n/root5)
end
puts fibo(ARGV.first.to_i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment