Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #87837 > unrolled thread

Re: fibonacci series what Iam is missing ?

Started byChris Angelico <rosuav@gmail.com>
First post2015-03-24 03:59 +1100
Last post2015-03-23 11:39 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: fibonacci series what Iam is missing ? Chris Angelico <rosuav@gmail.com> - 2015-03-24 03:59 +1100
    Re: fibonacci series what Iam is missing ? CHIN Dihedral <dihedral88888@gmail.com> - 2015-03-23 11:39 -0700

#87837 — Re: fibonacci series what Iam is missing ?

FromChris Angelico <rosuav@gmail.com>
Date2015-03-24 03:59 +1100
SubjectRe: fibonacci series what Iam is missing ?
Message-ID<mailman.74.1427129999.10327.python-list@python.org>
On Tue, Mar 24, 2015 at 3:16 AM, Dave Angel <davea@davea.name> wrote:
> An entirely separate question is whether you can gain performance by caching
> intermediate values.  For example, if you capture values in a list, you
> could potentially save a lot of time, at least for non-trivial values of n.

If you take a step back and seek to print a sequence of Fibonacci
numbers, rather than calculating specific ones based on their indices,
then you don't even need to consider caching. As soon as you've
printed out a number, you move right along.

ChrisA

[toc] | [next] | [standalone]


#87842

FromCHIN Dihedral <dihedral88888@gmail.com>
Date2015-03-23 11:39 -0700
Message-ID<0f56793c-3211-4825-b43c-24569bb99708@googlegroups.com>
In reply to#87837
On Tuesday, March 24, 2015 at 1:00:11 AM UTC+8, Chris Angelico wrote:
> On Tue, Mar 24, 2015 at 3:16 AM, Dave Angel <davea@davea.name> wrote:
> > An entirely separate question is whether you can gain performance by caching
> > intermediate values.  For example, if you capture values in a list, you
> > could potentially save a lot of time, at least for non-trivial values of n.
> 
> If you take a step back and seek to print a sequence of Fibonacci
> numbers, rather than calculating specific ones based on their indices,
> then you don't even need to consider caching. As soon as you've
> printed out a number, you move right along.
> 
> ChrisA

Well, the good part is that the python version can compute the right
result for a  much larger n in 
fib(n). 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web