Newbie question - calculating prime numbers

2010-08-10 Thread Matty Sarro
Hey Everyone, I'm currently trying to work through MIT's opencourseware and am using python. The second assignment they offer is to determine the 1000th prime number. Below is the code I am using: #Assignment 1a #Determine the 1000th prime number candidate=3 #Already know that 2 is prime

Re: Newbie question - calculating prime numbers

2010-08-10 Thread Dave Angel
Matty Sarro wrote: Hey Everyone, I'm currently trying to work through MIT's opencourseware and am using python. The second assignment they offer is to determine the 1000th prime number. Below is the code I am using: #Assignment 1a #Determine the 1000th prime number candidate=3 #Already know

Re: Newbie question - calculating prime numbers

2010-08-10 Thread Matty Sarro
Hey Dave, Thank you for the heads up. I actually bashed my head against the desk a few times and eventually I realized what I was doing wrong. Here's my final code (slightly optimized) that's verified and working. Out of curiousity, what other optimizations could I throw at it (without diving too

Re: Newbie question - calculating prime numbers

2010-08-10 Thread Ian
On 10/08/2010 12:57, Matty Sarro wrote: Hey Everyone, I'm currently trying to work through MIT's opencourseware and am using python. The second assignment they offer is to determine the 1000th prime number. Below is the code I am using: #Assignment 1a #Determine the 1000th prime number

Re: Newbie question - calculating prime numbers

2010-08-10 Thread Peter Otten
Matty Sarro wrote: Hey Dave, Thank you for the heads up. I actually bashed my head against the desk a few times and eventually I realized what I was doing wrong. Here's my final code (slightly optimized) that's verified and working. Out of curiousity, what other optimizations could I throw

Re: Newbie question - calculating prime numbers

2010-08-10 Thread Dave Angel
Matty Sarro wrote: Hey Dave, Thank you for the heads up. I actually bashed my head against the desk a few times and eventually I realized what I was doing wrong. Here's my final code (slightly optimized) that's verified and working. Out of curiousity, what other optimizations could I throw at it