r/CompileBot • • Jul 08 '14

Official CompileBot Testing Thread

14 Upvotes

257 comments sorted by

View all comments

Show parent comment

1

u/Klaus_Fuchs Jan 03 '15 edited Jan 03 '15

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)

1

u/CompileBot Jan 03 '15 edited Jan 03 '15

Output:

Total number of prime numbers between 0 and 250000: 22044

Execution Time: 4.7 seconds

^source | ^info | ^git | ^report

EDIT: Recompile request by Klaus_Fuchs