Fibonacci Series
The Fibonacci sequence is the series of numbers:
First, the terms are numbered from 0 onwards like
this:
n =
|
0
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
...
|
xn =
|
0
|
1
|
1
|
2
|
3
|
5
|
8
|
13
|
21
|
34
|
55
|
89
|
144
|
233
|
377
|
...
|
The next
number is found by adding up the two numbers before it.
The Rule is : xn = xn-1 + xn-2
The sequence works
below zero also, like this:
n =
|
...
|
-6
|
-5
|
-4
|
-3
|
-2
|
-1
|
0
|
1
|
2
|
3
|
4
|
5
|
6
|
...
|
xn =
|
...
|
-8
|
5
|
-3
|
2
|
-1
|
1
|
0
|
1
|
1
|
2
|
3
|
5
|
8
|
...
|
(Prove to yourself that each number is
found by adding up the two numbers before it!)
In fact the sequence below zero has
the same numbers as the sequence above zero, except they follow a +-+- ...
pattern. It can be written like this:
x−n
= (−1)n+1 xn
Which says that term "-n" is
equal to (−1)n+1 times term "n", and the value (−1)n+1 neatly makes
the correct 1,-1,1,-1,... pattern.
History
Fibonacci was not the first to know about the sequence, it was
known in India hundreds of years before.
Fibonacci’s real name was Leonardo Pisano Bogollo, and he lived
between 1170 and 1250 in Italy.
"Fibonacci" was his nickname, which roughly means
"Son of Bonacci".
As well as being famous for the Fibonacci Sequence, he helped
spread Hindu-Arabic Numerals (like our present numbers 0,1,2,3,4,5,6,7,8,9)
through Europe in place of Roman Numerals (I, II, III, IV, V, etc). That has
saved us all a lot of trouble! Thank you Leonardo.
Fibonacci Day is November 23rd, as it has the digits "1, 1,
2, 3" which is part of the sequence. So next Nov 23 let everyone know!
Program in C:
//COPY AND PASTE IT :D
int main()
printf("Enter the number of terms\n");
printf("First %d terms of Fibonacci series are :-\n",n);
for (i = 0 ; i <= n ; i++ )
getch();
}
#include<stdio.h>
#include<conio.h>
int fab(int);
int main(char arg , int **p){
int n, i =0,c;
printf("\nEnter the number till you want fibonacci series\n");
scanf("%d",n);
for(c=0;c<=n;c++)
{
printf("%d",fab(i));
i++;
}
getch();
return 0;
}
int fab(int n){
if(n ==0)
return 0;
else if (n ==1)
return 1;
else return fab(n-1) + fab(n-2);
}
Program in C:
//COPY AND PASTE IT :D
#include<stdio.h>
#include<conio.h>
int main()
{
int n,
fab1=0,fab2=1,fab=0,i=0;
printf("Enter the number of terms\n");
scanf("%d",&n);
printf("First %d terms of Fibonacci series are :-\n",n);
for (i = 0 ; i <= n ; i++ )
{
printf("%d ",fab1);
fab = fab1+fab2;
fab1 = fab2;
fab2 = fab;
}
getch();
return 0;
}
#include<stdio.h>
#include<conio.h>
int fab(int);
int main(char arg , int **p){
int n, i =0,c;
printf("\nEnter the number till you want fibonacci series\n");
scanf("%d",n);
for(c=0;c<=n;c++)
{
printf("%d",fab(i));
i++;
}
getch();
return 0;
}
int fab(int n){
if(n ==0)
return 0;
else if (n ==1)
return 1;
else return fab(n-1) + fab(n-2);
}