Example #1
0
	def checkPrime(self, number):

		#Anython under or equal to one is not prime. 
		if(number<=1):
			return False
		
		#Get the sqaure root of the number to be checked. 
		limit = math.sqrt(number)

		#Sieve of up the limit. 
		sieve = sieve_e(int(limit))
		#Generate the numbers up to the limit. 
		sieve.genNumbers()
		#Get the list of the sieved numbers. 
		divisions = sieve.sieve()
		
		#For each of the prime numbers in the list(if any)
		for num in divisions:
			#If the number divides then it is not prime. 
			if(number % num == 0):
				return False

		#If nothing divides then return true. 
		return True
Example #2
0
#Print the set limits to the user.
print "Lowest: " + str(LOW_LIMIT)
print "Highest: " + str(UP_LIMIT)
print " "

print "[+] Generating ..."

#Create empty lists to hold values. 
time_x = []
limit_y = []

#While there are still values to generate.. 
while(CURRENT<=UP_LIMIT):
	
	#Create a new instance of the sieve class and set the numbers to be generated to the current interation.
	test = sieve_e(CURRENT)
	#Generate the numbers. 
	test.genNumbers()

	#Get the current system time. (GET TIME BEFORE SIEVE)
	current_time = int(round(time.time() * 1000))

	#Sieve the composite numbers. 
	#primes = test.sieve_recursion(0)
	primes = test.sieve()
	print primes

	#Get the current system time. (GET TIME AFTER SIEVE)
	after_time = int(round(time.time() * 1000))

	#Add the time it took to execute to the time list. 
Example #3
0
from SOE import sieve_e
import sys

if(len(sys.argv)>1):
	limit = int(sys.argv[1])
else:
	limit = 100
	print "[+] No Parameter given, Default limit of 100."




test = sieve_e(limit)

test.genNumbers()

L = test.sieve()

print L

print str(len(L)) + " Prime Numbers Found."

raw_input()