---------- Forwarded message ----------
From: Ray Holt <[email protected]>
Date: Mon, Nov 16, 2009 at 1:55 PM
Subject: RE: [Tutor] Help on finding the 1000th prime
To: Kent Johnson <[email protected]>


I hit the send button before I was ready. Here is the code that doesn't
work.
primeCount = 0
primeCandidate = 2
While primeCount <= 1000:
isPrime = True
       primeCandidate = primeCandidate + 2
       for x in range(2, primeCandidate):
               if primeCandidate % x == 0:
       print primeCandidate, "equals", x, "*", primeCandidate/x
       isPrime = False
Print primeCandidate
       break
If isPrime:
       primeCount = primeCount + 2
Print primeCandidate


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Kent
Johnson
Sent: Monday, November 16, 2009 12:33 PM
To: Ray Holt
Cc: [email protected]
Subject: Re: [Tutor] Help on finding the 1000th prime

On Mon, Nov 16, 2009 at 10:56 AM, Ray Holt <[email protected]> wrote:
> I have posted this on other lists, but have just discovered this one.
> Can someone give me help on writing the code necessary to find the
> 1000th. prime number. I know I will have to use a while loop, but I
> can't seem to get the body of the code to function rightly.

What have you tried so far? What don't you understand?

Kent
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to