6 lines
101 B
Text
6 lines
101 B
Text
|
|
import math.sqrt
|
||
|
|
|
||
|
|
def fib( n ) =
|
||
|
|
phi = (1 + sqrt( 5 ))/2
|
||
|
|
int( (phi^n - (-phi)^-n)/sqrt(5) + .5 )
|