Chitty The Robot
Time Limit: 1 sec
The Problem
The Fibonacci numbers form a sequence of integers, mathematically defined by
F(0)=0; F(1)=1; F(n) = F(n - 1) + F(n - 2) for n > 1.
This results in the following sequence of numbers:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987 and so on.
So that each new Fibonacci number is the sum of the previous two Fibonacci number, after seeding the sequence with the starting pair 0, 1.
In the Tamil Science fiction film Enthiran when Chitty the Robot was asked whether 24157817 is a Fibonacci number, Chitty replies in affirmative and says that it is the 22nd Fibonacci number. However, it is actually the 37th Fibonacci number; the 22nd Fibonacci number is 17711.
Can you help Chitty to find the position of a given Fibonacci number?
The Input
The input file will contain one or more test cases. Each test case consists of one integer n (Fibonacci number) with 2<=n<=12586269025. Input will be terminated by a value of 0 for n.
The Output
For each test case, print one line of the form “The position of Fibonacci number (n) is m.”, where n is the given Fibonacci number and m is the position of given Fibonacci number (n).
Sample Input
2
102334155
24157817
17711
0
Sample Output
The position of Fibonacci number (2) is 3.
The position of Fibonacci number (102334155) is 40.
The position of Fibonacci number (24157817) is 37.
The position of Fibonacci number (17711) is 22.
Problem Setter: Shahin ShamS