#C12410. Prime Range Query

    ID: 41835 Type: Default 1000ms 256MiB

Prime Range Query

Prime Range Query

Given two integers \(S\) and \(E\), find and list all the prime numbers in the inclusive range \([S, E]\). A prime number is defined as a natural number greater than 1 that has no positive divisors other than 1 and itself. Using efficient algorithms, your task is to determine which numbers within the given range are prime.

For example, if the input is "10 50", the output should be "11 13 17 19 23 29 31 37 41 43 47".

inputFormat

The input consists of a single line containing two space-separated integers \(S\) and \(E\) where \(1 \leq S \leq E \leq 10^6\).

outputFormat

Output the list of prime numbers within the range \([S, E]\) in ascending order, separated by a single space.

## sample
10 50
11 13 17 19 23 29 31 37 41 43 47