Possible Duplicate:
nth fibonacci number in sublinear time
I was creating a program which is related to the stair problem, i.e you have n stairs and the player can climb on the stairs using them one by one or skipping one ...
Now to solve this problem I needed nth (n+1)th term for the Fibonacci for n number of stairs, but the problem is my input range is 1 ≤ n ≤ 1000000.
And for that much greater value of n if I use the loop based method or recursion to calculate the Fibonacci the method takes very much time and space. That I do not have.
So please can you tell me some method in the Java or C to handle Fibonacci series up to that range with correct output?
Note: Please I do not need any solution which has recursion or loop.