Ad

I used mathematical analysis to find the two constants, from the iterative form: f(n) = f(n-1) + f(n-2) and initial conditions.

# Fibonacci #

from math import sqrt

c1 = (sqrt(5) - 1) / (2 * sqrt(5))
c2 = (sqrt(5) + 1) / (2 * sqrt(5))

def f(x):
    fibo = c1 * ((1 - sqrt(5)) / 2)**x + c2 * ((1 + sqrt(5)) / 2)**x
    return int(round(fibo))