Repository navigation
This is only here to have a release at all, since many benchmarks are combined here. It's just the oldest one I use myself, even though I started with Basic and a far worse algorithm. See here
The code is simple:
import math, time
last = 1000000
found = 4 # we start from 11, know 2, 3, 5, 7
print(f"Prime numbers to {last}")
start = time.monotonic()
for number in range(11, last, 2):
prime = True
for divider in range(3, int(math.sqrt(number))+1, 2):
if number % divider == 0:
prime = False
break
if prime:
found += 1
end = time.monotonic()
print(f"This took: {(end - start)} seconds.")
print(f"I found {found} prime numbers.")