I've been working on a coding challenge, and have determined how to perform a solution in logarithmic time; however, I'd like to solve it in constant time.
Given Binet's Formula for calculating the $n$-th Fibonacci sequence, I'd like to find the inverse to calculate when the Fibonacci sequence is equal to or less than some number.
Here is Binet's formula for a refresher:
$F_n = ((\frac{1+\sqrt5}{2})^n - (\frac{1-\sqrt5}{2}) ^n) / \sqrt5$
which can be simplified to:
$y = A^x - B^x$
$A = \frac{1+\sqrt5}{2}$, $B = \frac{1-\sqrt5}{2}$, $y = \frac{F_n}{\sqrt5}$, $x = n$
I'd like to solve for x; however I do not have the knowledge or educational experience to solve logarithms of different bases.
If I try:
$A^x = y + B^x$
$\log_A(A^x) = \log_A(y + B^x)$
$x = \log_A(y + B^x)$
which I am unsure how to solve from there. Is this problem even solvable?