sunu0000

PRBLM 2/1

Jul 4th, 2011
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. count = 0
  2. n = 1
  3. while count < 1000:
  4.     n = n + 1
  5.     divisors = 0
  6.     for testdiv in range(1,n+1):
  7.         testrem = n%testdiv
  8.         if testrem == 0:
  9.             divisors = divisors + 1
  10.     if divisors < 3:
  11.         count = count + 1
  12. print ("the thousandth prime number is", n)
Advertisement
Add Comment
Please, Sign In to add comment