Sparky1972

Compute 1000th Prime Number

May 4th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. #assignment 1,compute and print the 1000th prime number
  2. c = 1 #count of prime numbers
  3. p = 3 #number to be evaluated for prime
  4. while c < 1000:
  5.     for i in range(2, p):
  6.         if p%i !=0:
  7.             c = c+1
  8.             p = p+2
  9.         else:
  10.             c = c
  11.             p = p+2
  12. print p
Advertisement
Add Comment
Please, Sign In to add comment