41 points · by pkrumins · 17y ago · 27 comments
Here's a link to the closed form solution: http://en.wikipedia.org/wiki/Fibonacci_number#Closed_form_ex...
I'd be surprised if there isn't a true linear time algorithm for Fibonacci, it's just that it's more subtle than people think.
PS: Finding an optimal sequence of multiples and squares for computing an arbitrary power is still an open question.
I'm trying to figure out if you're intentionally making a sophisticated math joke or not -- and failing. Are you?
The precision to which you need to compute phi in order to compute the Nth Fibonacci number by exponentiation is the precision you'd obtain by computing the ratio of the Nth and (N-1)th Fibonacci numbers -- which is exactly how you evaluate the continued fraction for phi.
So your suggestion amounts to "compute the Nth Fibonacci number... then do a lot of work to use that value to compute the Nth Fibonacci number". :-)
In that case you can keep the value of sqrt(5) as sqrt(5) knowing it will cancel out at some point.
Overlooking this would lead one to believe there are known algorithms that solve NP-C problems in polynomial time (e.g., knapsack problem can be solved in polynomial time with respect to the decimal values of its inputs, but exponential with respect to the length of the binary encoding).
That doesn't make any sense. The number of binary and decimal digits has a linear relation. I think the ratio is log(10) / log(2) or about 3.32 .
the other is that addition of two D-digits numbers takes O(D) time (this is what the author means to expose in the article). as you have pointed out, the base (10, or 2, or anything else) does not matter for asymptotic analysis here, because the logarithm functions are all linearly related.
http://en.wikipedia.org/wiki/Fibonacci_Numbers#Closed_form_e...
Couldn't there be a faster way to evaluate it using an algebraic rather than a computational way? I just find the bound you give too high but I may be completely wrong.