View Single Post
  #4   Spotlight this post!  
Unread 23-06-2008, 08:09
ComradeNikolai ComradeNikolai is offline
Registered User
AKA: Nicholas
FRC #2603 (Team Hornet)
Team Role: Mentor
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Medina, Ohio
Posts: 203
ComradeNikolai is a splendid one to beholdComradeNikolai is a splendid one to beholdComradeNikolai is a splendid one to beholdComradeNikolai is a splendid one to beholdComradeNikolai is a splendid one to beholdComradeNikolai is a splendid one to beholdComradeNikolai is a splendid one to behold
Re: Fibonacci Sequence

Oh, yeah, my bad; it is the 1001th term. That makes the one my computer chugged all night for the million and first term, and it was bigger than the gnome terminal can display ... so I don't have it.

Here's the program, as requested
Code:
#! /usr/bin/python
a,b,c = 0,1,1000
while c > 0:
	a,b,c = b, a+b, c-1
print b
c could be modified to get any given term, adjusting for the first term already being calculated. I'm not sure if there's a more efficient way of doing this in Python, just started learning it.

Perl impresses me.
__________________
I cut myself shaving with Occam's razor.

Reply With Quote