I wrote two codes with almost same structure,
def prime_gen1(Limit = 10000):
    List = [2,]
    for x in range(3,Limit):
        for y in List:
            if not x%y:
                break
        if not x%y:
            continue
        else:
            List.append(x)
            yield x
def prime_gen2(Limit = 10000):
    from math import floor
    for x in range(3,Limit):
        for y in range(2, floor(x**0.5)+2):
            if not x%y:
                break
        if not x%y:
            continue
        else:
            yield x
>>> list(prime_gen1(20000)) == list(prime_gen2(20000))
True
>>> def time1(number):
    st = time()
    list(prime_gen1(number))
    end = time()
    return end - st
>>> def time2(number):
    st = time()
    list(prime_gen2(number))
    end = time()
    return end - st
One does same work as other, but the latter actually works much faster. I'm wondering why this happens.
Logically - or nonlogically, I thought checking with primes will outdo the other way, in this case- checking by numers between 3 and root of number.But time-checking showed vice versa, checking with all the numers works much faster - about 5 times. Its performance increasingly differs,
>>> time1(200000)
8.185129404067993
>>> time2(200000)
0.4998643398284912
Second method is outdoing it. What makes this different?
 
     
     
    