938dd0bbb5145aa7c60127745ae0571cb20a2387,maths/prime_numbers.py,,primes,#Any#,4

Before Change


    >>> primes(1_000_000)[-1]
    999983
    
    max += 1
    numbers = [False] * max
    ret = []
    for i in range(2, max):
        if not numbers[i]:
            for j in range(i, max, i):
                numbers[j] = True
            ret.append(i)
    return ret


if __name__ == "__main__":

After Change


    9973
    
    numbers: Generator = (i for i in range(1, (max + 1)))
    for i in (n for n in numbers if n > 1):
        for j in range(2, i):
            if (i % j) == 0:
                break
        else:
            yield i


if __name__ == "__main__":
    number = int(input("Calculate primes up to:\n>> ").strip())
    for ret in primes(number):
        print(ret)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: TheAlgorithms/Python
Commit Name: 938dd0bbb5145aa7c60127745ae0571cb20a2387
Time: 2019-12-06
Author: vargasnikolass@gmail.com
File Name: maths/prime_numbers.py
Class Name:
Method Name: primes


Project Name: keras-team/keras
Commit Name: 04a20177cf332004a291cee626c20a0262427796
Time: 2017-06-21
Author: chris.kerr@athion.de
File Name: keras/wrappers/scikit_learn.py
Class Name: BaseWrapper
Method Name: check_params


Project Name: keras-team/keras
Commit Name: ced84c4b42d9186842e4cad6c11b0c8f2c18439b
Time: 2017-06-16
Author: chris.kerr@athion.de
File Name: keras/wrappers/scikit_learn.py
Class Name: BaseWrapper
Method Name: check_params