def gen_primes(limit): for dividend in range(2, limit + 1): for divisor in range(2, dividend): if dividend % divisor == 0: break else: print(dividend)