#C14432. Sieve of Eratosthenes: Find Primes in a Range

    ID: 44081 Type: Default 1000ms 256MiB

Sieve of Eratosthenes: Find Primes in a Range

Sieve of Eratosthenes: Find Primes in a Range

This problem requires you to find all prime numbers within a given range [L, R] using the Sieve of Eratosthenes algorithm. You will be given two integers as input, and you need to output all the prime numbers in that range in increasing order. If there are no prime numbers in the range, output an empty line.

The algorithm should be efficient enough to handle the upper limits of the range.

The mathematical definition of a prime number is a number \(p\) such that \(p > 1\) and its only divisors are 1 and \(p\) itself.

inputFormat

The input consists of a single line containing two space-separated integers: start and end (\(L\) and \(R\)), where 0 \(\leq L \leq R\).

outputFormat

Output the prime numbers in the range [L, R] in ascending order, separated by a single space. If there are no prime numbers, output an empty line.

## sample
10 30
11 13 17 19 23 29