We have discussed different methods to find nth Fibonacci Number.
Following is another mathematically correct way to find the same.
nth Fibonacci Number :
Here φ is golden ratio with value as
The above formula seems to be good for finding nth Fibonacci Number in O(Logn) time as integer power of a number can be calculated in O(Logn) time. But this solution doesn’t work practically because φ is stored as a floating point number and when we calculate powers of φ, important bits may be lost in the process and we may get incorrect answer.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- G-Fact 19 (Logical and Bitwise Not Operators on Boolean)
- G-Fact 20 (Cayley’s formula for Number of Labelled Trees)
- G-Fact 17
- G-Fact 1 | (Sizeof is an operator)
- fseek() vs rewind() in C
- Vantieghems Theorem for Primality Test
- Cauchy’s Mean Value Theorem
- Nesbitt’s Inequality
- GFact 23 | (Brocard’s problem)
- GFact 22 | (2^x + 1 and Prime)