Having a problem finding the first 1000 prime numbers, here is my code:-

print(2)
n =3
counter =1
while counter <=1000:
  for x in range(3,int((n**0.5)),2):
    if n%x != 0:
      print(n)
      n+=1
      counter+=1
    else:
      n+=1

The problem is, it prints 2 and then does nothing, yet if i try and close,
it says program is still running do you want to kill it, is there a way to
do this with lists, i know python has a prime function but i am not going to
use it because i want to solve this problem without 'cheating'.Thanks.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to