Quantcast
Viewing latest article 8
Browse Latest Browse All 11

1000th Prime Number in Python

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 latest article 8
Browse Latest Browse All 11

Trending Articles