//Programmer: Larry Battle
//Date: April 18, 2011
//Purpose: Get Fibonacci numbers in O(1) time.
var getFibonacciNum = function( n ){
var s5 = Math.sqrt(5);
var phi1 = (1+s5)/2, phi2 = (1-s5)/2;
return Math.round((Math.pow( phi1, n ) - Math.pow( phi2, n) )/s5);
};
Demo:
Output for 0 to 4
F(0) = 0 F(1) = 1 F(2) = 1 F(3) = 2 F(4) = 3
What REALLY is Data Science? Told by a Data Scientist - By Joma Tech
Writing perfect code is a challenging process. That's where code reviews come in to help…
"The Next Leap: How A.I. will change the 3D industry - Andrew Price - Blender"
"Captain Disillusion: World's Greatest Blenderer - Live at the Blender Conference 2018 - CaptainDisillusion"
My 5 Favorite Linux Shell Tricks for SPEEEEEED (and efficiency) - By tutoriaLinux > What's…