Originally posted by mintoo kumar: if you want to know the code.
Please don't simply post answers like that, otherwise nobody will learn anything.
And the first two Fibonacci numbers in the commonest sequence are 1 and 1, not 0 and 1. The 10th number in the commonest fibonacci sequence is 55. Your method prints 55 as the 9th member of its sequence.
I do agree that i should not write simply the code ,actually i misunderstood the problem. But as far as my code is concernt it's fine
___________________________________________________________________________ And the first two Fibonacci numbers in the commonest sequence are 1 and 1, not 0 and 1. The 10th number in the commonest fibonacci sequence is 55. Your method prints 55 as the 9th member of its sequence. ___________________________________________________________________________
In my code i consider a=0,b=1 which is the initial number of fibnocii series. I have not mentioned it in output because i already declalred it .so if you consider this a=0,b=1 then output will be like 0,1,1,2,3..... I believe now you will find it correct.
Originally posted by Campbell Ritchie: And how often has Wikipedia got anything right?
Pretty often. I mean, I know that wikipeida is more than capable of getting things wrong, but overall my experience is that their info is good much more often than it's bad. You seem to be massively overstating their problems.
In this case, it seems obvious that the Fibonacci sequence F(1, 1) is a subsequence of F(0, 1). So are F(1, 2), F(2, 3), F(2, 5) etc. And there's no other Fibonacci sequence that F(0, 1) is contained within. So it seems natural to start the sequence as far back as possible and consider that the beginning. It's possible to define things differently, but I don't really see the point. The differences are pretty trivial anyway, as long as you know which definition is being used at any given time.
"I'm not back." - Bill Harding, Twister
Joined: Oct 13, 2005
All right, then, I'll believe that the 0th member is 0 and the 1st member is 1, at least of the commonest Fibonacci sequence. That has the advantage of allowing you to say
Joined: Jan 30, 2000
Um, OK. The Wikipedia article also uses 0 and 1 as the indices for values 0 and 1. It's arguable whether those should be called "first" and "second" or "zeroth" and "first". But we have that same ambiguity talking about Java arrays.
[Jim]: And there's no other Fibonacci sequence that F(0, 1) is contained within.
This is an error on my part. The main Fibonacci sequence can be extended as far back as you like. E.g.
which contains F(0, 1) within it, starting from position 7 (the eighth element) . Note that the magnitudes of the earlier values mirror the later values, with alternating sign. It still seems to make some sense to me to choose 0 as the main reference point, due to symmetry. But it isn't really the earliest point possible; there is no earliest point possible.