yeah .....
here goes d progrm
#include<iostream.h>
#include <conio.h>
void main()
{
int fo,f1,f,n;
fo=0;
f1=1;
cout<<"fibbonacci series
";
cout<<"
"<<fo<<"
"<<f1;
for(i=3;i<=n;i++)
{
f=fo+f1;
cout<<:
"<<f;
fo=f1;
f1=f2;
}
}
u i'll get d fibbonacci series
we know fibonacci series..
1 1 2 3 5 8..........
is there a way to find the nth term?
-
UP 0 DOWN 0 0 5
5 Answers
let me state first that it is a general way to find nth term of a linear recurrence relation.
suppose Fn=a* F(n-1)+ b* F(n-2).
here a=b=1.
replace F(n) by xn. i'm not explaining why. those who are interested may check a topic called GENERATING FUNCTION.
you get a equation x2-a*x-b=0. [here x2-x-1=0]
get the two roots. let they be α,β.
then general term is F(n)= k1* (α)n + k2 * (β)n .
value of k1 and k2 are to be found by putting n=1 and n=2.
i forgot to mention above is only valid iff α≠β. for α=β,
F(n)=(k1+k2* n)* (α)n.
http://targetiit.com/iit-jee-forum/posts/poser-test-your-mind-1656.html
all this seems so historical , almost black and white .....