Fibonacci Series

Fibonacci Series:

In mathematics, the Fibonacci numbers are the numbers in the following integer sequence :
0,\;1,\;1,\;2,\;3,\;5,\;8,\;13,\;21,\;34,\;55,\;89,\;144,\; 
\ldots\; 
By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two.
In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation
F_n = F_{n-1} + F_{n-2},\!\,
It is not possible to find a large Fibonacci number in recurrence method. Because there will so many function call. So, we will use an algorithm.
At first, We take one 2D char table.   
    initially assume that :
        table[0][0]=0;
        table[1][0]=1;
        table[2][0]=1;

And enter number according to fibonacci Rule. If num >9 then mod it with 10 and put it in table.
when we want to see the 5th fibo number, we print 5th row of 2D string in reverse way until we get 0 .
We do the same procedure to find out the Factorial of big number.
The process is shown in Below :

5
The Fibonacci number for 5 is 5
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0
3 0 0 0 0 0 0 0 0 0
5 0 0 0 0 0 0 0 0 0
8 0 0 0 0 0 0 0 0 0
3 1 0 0 0 0 0 0 0 0
1 2 0 0 0 0 0 0 0 0
4 3 0 0 0 0 0 0 0 0
9
The Fibonacci number for 9 is 34
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0
3 0 0 0 0 0 0 0 0 0
5 0 0 0 0 0 0 0 0 0
8 0 0 0 0 0 0 0 0 0
3 1 0 0 0 0 0 0 0 0
1 2 0 0 0 0 0 0 0 0
4 3 0 0 0 0 0 0 0 0



মন্তব্যসমূহ