News for hackers. Stuff that matters.
Re:Common Species Of Code by robomartin on Monday November 11, 2013 @09:39AM (#6711774)
Closed-form expression [0], good up to n == 71:

   def fibonacci(n):
        gr = (1 + (5**0.5)) / 2 
        return int((gr**int(n) - (-gr)**int(-n)) / 5**0.5)

[0] http://en.wikipedia.org/wiki/Fibonacci_number#Closed-form_ex...
Re:Common Species Of Code by LinaLauneBaer on Monday November 11, 2013 @10:15AM (#6711971)
I wanted to mention this as well. There is actually a closed form (as you indicated). Also good to know: This is or was a interview question at Google. You had to know Moivre-Binet's closed formula from the top of your head to pass.
Re:Common Species Of Code by speeder on Monday November 11, 2013 @10:46AM (#6712118)
I don't even know what is Moivre-Binet what the fuck.
Re:Common Species Of Code by robomartin on Monday November 11, 2013 @05:04PM (#6714402)
> You had to know Moivre-Binet's closed formula from the top of your head to pass.

What's unfortunate about what you just said is that this is utterly irrelevant as a test of coding or problem solving ability.

See my other comment about MIT 6.00.1x