Solve problem "The index of a Fibonacci number" online - Learn Python 3 - Snakify

The index of a Fibonacci number


Statement

The Fibonacci sequence is defined as follows: $$ \phi_0 = 0, \ \phi_1 = 1, \ \phi_n = \phi_{n-1} + \phi_{n-2} . $$ Given an integer \( a \), determine its index among the Fibonacci numbers, that is, print the number \( n \) such that \( \phi_n = a \). If \( a \) is not a Fibonacci number, print -1.
Advertising by Google, may be based on your interests

In all the problems input the data using input() and print the result using print().