Program to compute and print 1000th prime number

2009-11-07 Thread Ray Holt
I am taking the MIT online course Introduction to Computer Science and Programming. I have a assignment to write a program to compute and print the 1000th. prime number. Can someone give me some leads on the correct code? Thanks, Ray -- http://mail.python.org/mailman/listinfo/python-list

Re: Program to compute and print 1000th prime number

2009-11-07 Thread sstein...@gmail.com
On Nov 7, 2009, at 9:44 AM, Ray Holt wrote: I am taking the MIT online course Introduction to Computer Science and Programming. I have a assignment to write a program to compute and print the 1000th. prime number. Can someone give me some leads on the correct code? Thanks, Ray Copying

Re: Program to compute and print 1000th prime number

2009-11-07 Thread Robert P. J. Day
On Sat, 7 Nov 2009, sstein...@gmail.com wrote: On Nov 7, 2009, at 9:44 AM, Ray Holt wrote: I am taking the MIT online course Introduction to Computer Science and Programming. I have a assignment to write a program to compute and print the 1000th. prime number. Can someone

Re: Program to compute and print 1000th prime number

2009-11-07 Thread Raymond Hettinger
On Nov 7, 2009, at 9:44 AM, Ray Holt wrote:       I am taking the MIT online course Introduction to Computer Science and       Programming. I have a assignment to write a program to compute and print       the 1000th. prime number. Can someone give me some leads on the correct    

Re: Program to compute and print 1000th prime number

2009-11-07 Thread Robert P. J. Day
On Sat, 7 Nov 2009, Raymond Hettinger wrote: On Nov 7, 2009, at 9:44 AM, Ray Holt wrote:       I am taking the MIT online course Introduction to Computer Science and       Programming. I have a assignment to write a program to compute and print       the 1000th. prime number. Can

Re: Program to compute and print 1000th prime number

2009-11-07 Thread Xavier Ho
On Sun, Nov 8, 2009 at 12:44 AM, Ray Holt mrhol...@sbcglobal.net wrote: I have a assignment to write a program to compute and print the 1000th. prime number. Can someone give me some leads on the correct code? Ray, if you really want an answer out of this list, you'll have to at least show

Re: Program to compute and print 1000th prime number

2009-11-07 Thread Mensanator
On Nov 7, 11:23 am, Raymond Hettinger pyt...@rcn.com wrote: On Nov 7, 2009, at 9:44 AM, Ray Holt wrote:       I am taking the MIT online course Introduction to Computer Science and       Programming. I have a assignment to write a program to compute and print       the 1000th.

Re: Program to compute and print 1000th prime number

2009-11-07 Thread John Posner
Robert P. J. Day said: the ubiquitous sieve of eratosthenes requires you to pre-specify your maximum value, after which -- once the sieve completes -- all you know is that you have all of the prime numbers up to n. whether you'll have 1000 of them isn't clear, which means that you might have

Re: Program to compute and print 1000th prime number

2009-11-07 Thread Andre Engels
On Sat, Nov 7, 2009 at 6:40 PM, Mensanator mensana...@aol.com wrote: Tongue in cheek solution: import urllib2 url = 'http://primes.utm.edu/lists/small/1.txt' primes = [] for line in urllib2.urlopen(url).read().splitlines():     values = line.split()     if len(values) == 10:        

Re: Program to compute and print 1000th prime number

2009-11-07 Thread Wayne Brehaut
On Sat, 7 Nov 2009 19:34:47 +0100, Andre Engels andreeng...@gmail.com wrote: On Sat, Nov 7, 2009 at 6:40 PM, Mensanator mensana...@aol.com wrote: Tongue in cheek solution: import urllib2 url = 'http://primes.utm.edu/lists/small/1.txt' primes = [] for line in