Abhishek Jain abhishekjain.cooldude.93 at
Sun Aug 14 14:36:45 CEST 2011

Hello all,

I wrote a python program to find the 1000th prime no. The program isn't
working as it should be.
Please tell what the error is:

## this is to find the 1000th prime number

number = 3
while number < 10000:
    ###initialize stuff
    counter = 1
    ###initializing list to check primarity
    factor = []
    while counter!=(number/2):
        if number % counter == 0:
            factor = factor + [counter]
        counter = counter + 1
        if len(factor) > 1:
        elif counter == 1000:
            print number,

The program is printing all the prime nos. from 1009 to 9973. Please respond
fast and give me the correct code with only simple functions as i am a
beginner to python.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list