cancel
Showing results for 
Search instead for 
Did you mean: 

Fibonacci

Super User
664 Views
Super User
Super User

Fibonacci

Takes a single input, "n", where "n" is the nth Fibonacci number. 

 

 

Fibonacci = 
VAR n = MAX(<"n">)
VAR GoldenRatio = (1+SQRT(5))/2
VAR Part1 = POWER(GoldenRatio,n)
VAR Part2 = POWER(-1*DIVIDE(1,GoldenRatio),n)
VAR Numerator = Part1-Part2
VAR Denominator = SQRT(5)
RETURN DIVIDE(Numerator,Denominator)

 

 

 


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!