Primality Listing

View as PDF

Submit solution

Points: 1.00
Time limit: 1.0s
Lua 2.0s
Pypy3 2.0s
Python 3 2.0s
Ruby 2.0s
Memory limit: 512M
Input: stdin
Output: stdout

Author:
Problem source:
HNOI TST Trường THPT Mỹ Đức A (2024 - 2025)
Problem types

Attempt

Please login to see your submissions result.


Last updated: on Dec. 16, 2024, 8:56 a.m.

Problem

Given two positive integers ~L~, ~R~. Find all prime numbers in range ~[L, R]~.

(It means find all prime numbers ~X~ that ~L \leq X \leq R~).

Input

Single line contains two positive integers ~L, R~.

Output

Consists of prime numbers in the range ~[L, R]~. Each number is separated by a space.

Constraints

~1 \leq L \leq R \leq 10^{12}~.
~1 \leq R - L + 1 \leq 10^6~.

Sample

Sample Input Sample Output
15 30
17 19 23 29

Explanation

In the sample test, we have 4 prime numbers in range that satisfied with problem condition.


Comments

Please read the guidelines before commenting.


There are no comments at the moment.