Guest User

primebench

a guest
Apr 29th, 2018
177
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import math
  2. import time
  3. import os
  4.  
  5. t1=time.time()
  6. skip=False
  7. for i in range(2, 1001):
  8.     skip=False
  9.     k = math.floor(math.sqrt(float(i))) + 1.0
  10.     for j in range(2, int(k)):
  11.         k1=i/float(j)
  12.         k2=int(k1)
  13.         if k1==k2:
  14.             skip=True
  15.             break
  16.     if skip:
  17.         continue
  18.     print(i)
  19. t2=time.time()
  20. print("TIME=" + str(t2-t1))
  21. os.system("pause")
RAW Paste Data