-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.py
More file actions
40 lines (29 loc) · 736 Bytes
/
script.py
File metadata and controls
40 lines (29 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from time import time
from math import isqrt
# from numba import njit
def formater(number):
return f"{number:,}".replace(",", " ")
def prime_finder(goal:int):
for i in range(3, goal + 1, 2):
if i % 3 == 0:
continue
limit = isqrt(i)
j = 5
while j <= limit:
if i % j == 0 or i % (j + 2) == 0:
break
j += 6
def timer(goal:int):
start = time()
prime_finder(goal)
print(f"{formater(goal)}\n{time()-start}\n")
def repeater(goal:int):
for k in range(goal):
num = 10
while True:
timer(num)
num *= 10
if num == 10**7:
break
print("\n\n")
repeater(3)