3

Rather than computing out the whole Fibonacci sequence and check if $n$ is even and in there, is there a more straightforward way to compute if $n$ is a even Fibonacci number?

2 Answers2

2

The $n^\text {th} $ Fibonacci number is given by $$ F_n=\frac {\phi^n-(-\phi)^{-n}}{\sqrt {5}}, $$ where $\phi $ is the golden ratio. If your number is $x $, then you could try $$\frac {\cosh^{-1}(\sqrt {5}x/2)}{\ln\phi}.$$ If this is an even integer, then $x $ is a Fibonacci number. Also if $$\frac {\sinh^{-1}(\sqrt {5}x/2)}{\ln\phi}$$ is odd.

Plutoro
  • 22,730
  • 3
  • 41
  • 71
  • It's definitely true, but I don't think that using of golden ratio is a good idea. In my opinion, question related to very big numbers (small numbers we can find in a table or check OEIS for its), and you should use only integer operations (even if it's integer square root) – Michael Galuza Jul 18 '15 at 16:54
  • You are saying integer square roots should not be used? – Plutoro Jul 18 '15 at 16:56
  • of course no, it's my awful English. I want to say that $\sqrt5$ and $\ln\phi$ should not be used – Michael Galuza Jul 18 '15 at 17:01
0

Hint: $~F_n~\simeq~\dfrac{\phi^n}{\sqrt5}$

Lucian
  • 48,334
  • 2
  • 83
  • 154