To calculate the $n^{th}$ Fibonacci number, I can use the golden ratio.

\begin{align*} F_n=\frac{1}{\sqrt{5}}\bigg[\Big(\frac{1+\sqrt5}{2}\Big)^n-\Big(\frac{1-\sqrt5}{2}\Big)^n\bigg] \end{align*}

I can not figure out how to solve for $n$ in this equation.

Is there a way to take the log of the right-hand side?

  • 1
    $\begingroup$ See en.wikipedia.org/wiki/…. $\endgroup$ – lhf Apr 11 '17 at 23:44
  • $\begingroup$ @ZacharySelk Yes you are right. My comment was pointless and I deleted it. $\endgroup$ – Dario Apr 12 '17 at 0:00
  • 1
    $\begingroup$ For any nontrivial n, the contribution of the second term is tiny, so you can just multiply by sqrt(5), and take the base [1+sqrt(5)]/2 logarithm. $\endgroup$ – TMM Apr 12 '17 at 0:25

If I understand correctly, you have a number $F_n$ that is known to be a Fibonacci number and you would like to find the value of $n$. Clearly, extracting the $n$ from the Binet formula is tricky at best. The way around this is as follows: in my experience, the Binet equation can be written as

$$F_n=\text{round} (\phi^n/\sqrt{5})$$

where $\phi=(1+\sqrt{5})/2$.

Therefore I tried

$$n=\text{round} \left(\ln(\sqrt{5}\cdot F_n)/\ln \ \phi\right)$$

I have found empirically that this works for all $n>1$. I see that the problem was solved exactly on the Wiki page pointed out elsewhere on this post, but the presence of the $\pm$ leaves some ambiguity. The present solution seems to be more to the point.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.