gingebot

ps1a.py

Mar 9th, 2012
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. #Problem set 1a
  2. #Name: ###
  3. #Time: 8:15 -
  4.  
  5.  
  6. prime_count = 1
  7.  
  8. test_no = 3
  9.  
  10. test_divisor = 2
  11.  
  12. while prime_count < 1000:
  13.     if not test_no % test_divisor == 0:
  14.         #print 'divisor: ', test_divisor
  15.         if test_divisor < (test_no / 2) :
  16.             test_divisor = test_divisor + 1
  17.         else:
  18.             # prime number
  19.             print test_no
  20.             test_no = test_no + 2
  21.             test_divisor = 2
  22.             prime_count = prime_count + 1
  23.    
  24.     else:
  25.         test_no = test_no + 2
Advertisement
Add Comment
Please, Sign In to add comment