Guest User

Untitled

a guest
Sep 26th, 2012
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. def PrimeNumber():
  2.     prime = True
  3.     primeCount = 0
  4.     count = 1
  5.     while (primeCount < 1000):
  6.         for i in range(2,count):
  7.             if count % i != 0:
  8.                 div = 3
  9.                 while div < (count / 2):
  10.                     if count % div == 0:
  11.                         prime = False
  12.                         break
  13.                     elif count % div != 0:
  14.                         prime = True
  15.                        
  16.                     div += 2
  17.                
  18.                 break
  19.             elif count % i == 0:
  20.                 prime = False
  21.                 break
  22.            
  23.         if prime == True:
  24.             primeCount += 1
  25.        
  26.         count += 2
  27.         #While it isnt ideal, it works
  28.     print str(count-2) + ' is a prime number'
  29. PrimeNumber()
Advertisement
Add Comment
Please, Sign In to add comment