Find primes in a naive way
from time import * def naiveprms(n=1000): t = monotonic() for k in range(3, n+1): for j in range(2, k): if k % j == 0: break t = monotonic()-t print("Time: {0:.3f} seconds".format(t))
Create, edit, and import your Python scripts
Find primes in a naive way
from time import * def naiveprms(n=1000): t = monotonic() for k in range(3, n+1): for j in range(2, k): if k % j == 0: break t = monotonic()-t print("Time: {0:.3f} seconds".format(t))