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

Before Change


    
    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: 5

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: andresriancho/w3af
Commit Name: 3805aabae59e3ba5b16364f6839c8e20b2399d71
Time: 2017-06-29
Author: andres.riancho@gmail.com
File Name: w3af/core/controllers/delay_detection/aprox_delay_controller.py
Class Name: AproxDelayController
Method Name: delay_is_controlled


Project Name: allenai/allennlp
Commit Name: 40ec35876d38c4797ad3ee9bf911b019faa5a61d
Time: 2017-08-25
Author: mattg@allenai.org
File Name: allennlp/nn/initializers.py
Class Name: InitializerApplicator
Method Name: __call__