Re: calculating fibonacci[was: encryption]
 From: Ben Bacarisse <ben.usenet@xxxxxxxxx>
 Date: Tue, 16 Dec 2008 01:44:43 +0000
Gerry Quinn <gerryq@xxxxxxxxx> writes:
In article <874p159x2z.fsf@xxxxxxxxx>, ben.usenet@xxxxxxxxx says...<snip>
Gerry Quinn <gerryq@xxxxxxxxx> writes:
<snip>process Fib ( int n )
small = 1
large = 1
for i = 3 to n
calc = small + large
small = large
large = calc
next
return large
end process
... I suppose you could do what
my program does and keep the current list pared down to the two most
recent numbers, anyway.
Yes. Richard Harter has posted the functional equivalent of
iterating while holding two previous values.
<snip>
The Basic function serves equally well as a definition. Knowing how to
calculate the nth number in a series is a definition of the series.
It serves as a definition, yes, but it may not be as useful for
building the series if that is what you really want. If you call it
repeatedly to make the series you get (roughly) a quadratic
algorithm. If you want a linear function that makes a list (or array
if that is what Basic has) you need to rewrite it rather call the
function.

Ben.
.
 FollowUps:
 Re: calculating fibonacci[was: encryption]
 From: Gerry Quinn
 Re: calculating fibonacci[was: encryption]
 References:
 encryption
 From: Bill Cunningham
 Re:calculating fibonacci[was: encryption]
 From: Bill Cunningham
 Re: Re:calculating fibonacci[was: encryption]
 From: Bill Cunningham
 Re: Re:calculating fibonacci[was: encryption]
 From: Richard Heathfield
 Re: Re:calculating fibonacci[was: encryption]
 From: Bill Cunningham
 Re: calculating fibonacci[was: encryption]
 From: Patricia Shanahan
 Re: calculating fibonacci[was: encryption]
 From: Ben Bacarisse
 Re: calculating fibonacci[was: encryption]
 From: Bartc
 Re: calculating fibonacci[was: encryption]
 From: Ben Bacarisse
 Re: calculating fibonacci[was: encryption]
 From: Gerry Quinn
 Re: calculating fibonacci[was: encryption]
 From: Ben Bacarisse
 Re: calculating fibonacci[was: encryption]
 From: Gerry Quinn
 encryption
 Prev by Date: Re: calculating fibonacci[was: encryption]
 Next by Date: Re: calculating fibonacci[was: encryption]
 Previous by thread: Re: calculating fibonacci[was: encryption]
 Next by thread: Re: calculating fibonacci[was: encryption]
 Index(es):
Relevant Pages
