fork download
  1. from math import *
  2.  
  3. a, b = map(int, input().strip().split())
  4. n = max(2,a)
  5. s = ""
  6. while n <= b:
  7. sqrtN = int(0.1 + sqrt(n))
  8. isPrime = True
  9. p = 2
  10. while p <= sqrtN:
  11. if n%p == 0:
  12. isPrime = False
  13. break
  14. p += 1
  15. if isPrime:
  16. s += (str(n) + "\n")
  17. n += 1
  18. print(s, end = "")
  19.  
Success #stdin #stdout 1.18s 9328KB
stdin
999999999847 999999999947
stdout
999999999847
999999999857
999999999863
999999999877
999999999899
999999999937