输入样例:
5 27
输出样例:
11 13 17 19 23 29 31 37 41 43
47 53 59 61 67 71 73 79 83 89
97 101 103
# -*- encoding: utf-8 -*-
import mathdef get_primes(n):prime_list = [1] * (n + 1)for i in range(2, int(math.sqrt(n)) + 1):if prime_list[i]:for j in range(i * 2, n + 1, i):prime_list[j] = 0return [idx for idx in range(1, n + 1) if prime_list[idx]]if __name__ == '__main__':ns = list(map(lambda x: eval(x), (input()).split()))prime_list = get_primes(109999)for idx, p in enumerate(prime_list[ns[0]:(ns[1] + 1)]):print(p, end='')if (idx + 1) % 10 == 0:print('')else:if idx < ns[1] - ns[0]:print(' ', end='')else:print('')