fibonacci number

I was reading below link on fibonacci number

I have not understood what is fibonacci number and the logic to generate it using java program?

please advise
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

A  Fibonacci number is a number in the sequence defined by F[n]=F[n-1]+F[n-2] starting with F[0]=0, F[1]=1
each subsequent number is the sum of the previous two

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ignore that triangle of numbers at the top with all the red lines. It is called Pascal's triangle and is very interesting to us math folks, but it adds nothing to the programming challenge.
awking00Information Technology SpecialistCommented:
There's nothing magical in understanding Fibonacci numbers. We've probably all seen brainteasers where you're supposed to determine the next number in a sequence. If you were asked to do this given the series 0,1,1,2,3,5, wouldn't you expect the next number to be 8 (and the following number to be 13) given that the third number is the sum of the first two, the fourth the sum of the second two, the fifth the sum of the third two, the sixth the sum of the fourth two, etc. To generate them in Java is also a fairly simple routine using a loop or a recursionary function as has already been indicated. What is "magical" about Fibonacci numbers is how they exist so prevalently in nature. Things like the ratio of the spiral of a nautilus shell, the petals on flowers, and even the ratio of the lengths of the bones in your hand. There are anomalies, of course. Flowers and plants almost always have 1, 2, 3, 5, or 8 etc. petals or leaves. One of the reasons a four-leaf clover is so rare. No points please, I just wanted you to know why anyone cares about these numbers.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

zzynxSr. Software engineerCommented:
>> I have not understood what is fibonacci number
The article you point to is rather clear:
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.
What do you not understand from the above two sentences?

>> the logic to generate it using java program?
I guess the program just takes the two previous numbers, makes the sum of those and moves on.
What do you not understand?
fibonacciRecusion recursively applies the F[n]=F[n-1]+F[n-2] definition,
fibonacciLoop iteratively applies the each subsequent number is the sum of the previous two rule, (i.e. a dynamic programming optimization of the definition)
gudii9Author Commented:
now it is clear. I like below link better
public class MyFibonacci {
    public static void main(String a[]){
         int febCount = 15;
         int[] feb = new int[febCount];
         feb[0] = 0;
         feb[1] = 1;
         for(int i=2; i < febCount; i++){
             feb[i] = feb[i-1] + feb[i-2];
         for(int i=0; i< febCount; i++){
                 System.out.print(feb[i] + " ");

Open in new window

i got
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.