From: Michael Campbell Date: 2002-04-05T08:13:18+09:00 Subject: Re: Fibonacci Number Generators > The Fibonacci series should be: > > n | 0 1 2 3 4 5 6 7 8 9 ..... > f(n) | 0 1 1 2 3 5 8 13 21 34..... That depends on whom you ask. I've always seen the sequence starting with "1 1 2 3 5 8...", never with "0 1 1 2 3 5 8 ...", but maybe that's just a flawed past experience on my part. > Question for the learned, is there a faster/better way > to code this (syntactical differences aside)? You could "cache" previously calculated values in an array and look them up rather than recalculating up the chain each time, thus sacrificing space to gain time. Or, you could just used the closed form solution. =) (http://ulcar.uml.edu/~iag/CS/Fibonacci.html, http://mathworld.wolfram.com/FibonacciNumber.html, etc.) ===== -- Yahoo IM: michael_s_campbell __________________________________________________ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/