human
Find Index of given fibonacci number in constant time | A simple Python 3 program to find index of given Fibonacci number ..
if Fibonacci number is less than 2 , its index will be same as number.
iterate until generated fibonacci number is less than given fibonacci number.
res keeps track of number of generated fibonacci number.
Driver program to test above function"
Solution in Python:
 ... Give me a code to find Index of given fibonacci number in constant time and the other steps required?
assistant
#Here is code to find Index of given fibonacci number in constant time and the other steps required.
 def findIndex ( n ) :
	if ( n <= 1 ) :
		return n
	a = 0
	b = 1
	c = 1
	res = 1
	while ( c < n ) :
		c = a + b
		res = res + 1
		a = b
		b = c
	return res
result = findIndex ( 21 )
print ( result )