Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3.8
- from timeit import timeit as t
- from collections import deque
- TESTS = 8
- ps = deque()
- ts = [0] * TESTS
- def do():
- found = 0
- last = 1
- while found < 1_000_000:
- last += 1
- if not any(last % x == 0 for x in ps):
- ps.append(last)
- found += 1
- for n in range(TESTS):
- ps.clear()
- print(n)
- ts[n] = t(do)
- print(ts)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement