Advertisement
Dmitry1110

Простые числа

Jul 26th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. input_file = open('input.txt')
  2. M, N = [int(i) for i in input_file.readline().split()]
  3. a = ''
  4. l = [True for i in range(N + 1)]
  5. l[1] = l[0] = False
  6. for i in range(2, N + 1):
  7.     if l[i] == True:
  8.         for j in range(i * i, N + 1, i):
  9.             if j % i == 0:
  10.                 l[j] = False
  11.  
  12. for i in range(M, N + 1):
  13.     if l[i] == True:
  14.         print(i)
  15.         a = ' '
  16. if a == '':
  17.     print('Absent')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement