RosettaCodeData/Task/Fibonacci-sequence/FunL/fibonacci-sequence-5.funl

6 lines
101 B
Text
Raw Permalink Normal View History

2016-12-05 23:44:36 +01:00
import math.sqrt
def fib( n ) =
phi = (1 + sqrt( 5 ))/2
int( (phi^n - (-phi)^-n)/sqrt(5) + .5 )