Recursion: Fibonacci Numbers

  • + 7 comments

    Nice :)

    Here is a one-liner in python,

    fib = lambda n:pow(2<<n,n+1,(4<<2*n)-(2<<n)-1)%(2<<n)
    print (fib(int(input())))
    

    Complexity :