Guest User

1001th prime number

a guest
Jan 15th, 2012
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. number = 5
  2. prime_count= 2
  3. listofPrimes=[2,3]
  4.  
  5. while prime_count < 1001:
  6. cud_b_prime = True
  7. divisor = 2
  8.  
  9. while divisor < number:
  10. if number % divisor ==0:
  11. cud_b_prime = False
  12. divisor +=1
  13.  
  14. if cud_b_prime:
  15. listofPrimes.append(number)
  16. prime_count +=1
  17. number += 2
  18. print listofPrimes[-1]
Advertisement
Add Comment
Please, Sign In to add comment