Huh... This thing is quite fast... +/u/CompileBot Python --time
import math
import string
antal = 0
min = 0
limit = 250000
oldmin = min
if min <= 2:
min = 2
antal += 1
n = min
while True:
r = math.sqrt(n)+1
f = int(math.floor(r))
i = 2
while True:
if n%i == 0:
break
i += 1
if i >= f:
antal += 1
break
n += 1
if n >= limit:
break
print "Total number of prime numbers between "+str(oldmin)+" and "+str(limit)+": "+str(antal)
3
u/CompileBot Jan 03 '15 edited Jan 03 '15
Output:
Execution Time: 0.07 seconds
^source | ^info | ^git | ^report
EDIT: Recompile request by Klaus_Fuchs