Quantcast
Channel: Programming Help Forums / Other Languages / Python
Viewing all articles
Browse latest Browse all 11

1000th Prime Number in Python

$
0
0
For an assignment for an online course I'm doing i have to make a program that will find the 1000th prime this is what I've come up with so far but it doesn't work. Could anyone help? or at least tell me why I don't get any output?

primecand = 3
count = 1
divisor = 2

while count < 999:
while divisor < primecand:
if primecand%divisor==0:
divisor=divisor+1
else:
primecand=primecand+1
count=count+1

print primecand


Thanks

Viewing all articles
Browse latest Browse all 11

Trending Articles