Hacker News new | ask | show | jobs
by Al-Khwarizmi 2814 days ago
The "right" way to do Fibonacci is to use matrix multiplication to get the nth Fibonacci number in logarithmic time (google Fibonacci log n matrix).
1 comments

A matrix implementatiom in JavaScript:

http://raganwald.com/2015/12/20/an-es6-program-to-compute-fi...

It is based on a Ruby implementation:

http://raganwald.com/2008/12/12/fibonacci.html