aslf010990's blog

By aslf010990, 9 years ago, In English

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.

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Would need big int though.

»
9 years ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

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