Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
415 B
2
Indexable
Never
count = 2

prime = 10001


for i in range(3, 1000000, 2): # starting at 3, to try save time, skipping even nums
 n = 1


 while n < i:
  n += 2

  if i % n == 0:
   break

  if n + 2 == i:
   count += 1

  if count == prime:
   print(i)
   raise ZeroDivisionError # Needed a way to end the program, upon researching you can raise exceptions. Done work with Mr Hughes on raising exceptions in OOP