Finding the closest fibonacci numbers

前端 未结 11 2178

I am trying to solve a bigger problem, and I think that an important part of the program is spent on inefficient computations.

I need to compute for a given number N, th

11条回答
  •  星月不相逢
    2021-02-02 14:07

    You can use the closed-form expression of the fibonacci numbers.

    Since the second term in it is very small, you can approximate it with just the first term, so n can be found with base-golden ratio logarithm.

提交回复
热议问题