Блог пользователя aslf010990

Автор aslf010990, 9 лет назад, По-английски

Hello, I have a question as to calculate the term x of the fibonacci suceción ?, the problem is that x may be a number between 1 and 10000, I try to calculate with recursion but takes a long time, me You Might support with some other method to calculate, thank you.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Would need big int though.

»
9 лет назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

Try matrix exponentation. Complexity with Binary pow is LOG(N). To get n-th Fibonacci number raise matrix to nth deegree.