import time
__author__ = 'Polo-Dev'
def is_prime(pList, number):
for i in pList:
if number % i == 0:
return False
return True
def main(given_number):
pList = []
for i in range(2, given_number):
if is_prime(pList, i):
pList.append(i)
print(i)
print(pList)
start_time = time.time()
main(100000)
end_time = time.time()
time_needed = float(end_time - start_time)
print(time_needed)
__author__ = 'Polo-Dev'
def is_prime(pList, number):
for i in pList:
if number % i == 0:
return False
return True
def main(given_number):
pList = []
for i in range(2, given_number):
if is_prime(pList, i):
pList.append(i)
print(i)
print(pList)
start_time = time.time()
main(100000)
end_time = time.time()
time_needed = float(end_time - start_time)
print(time_needed)
No comments:
Post a Comment