#C14279. List Prime Numbers Less Than N

    ID: 43910 Type: Default 1000ms 256MiB

List Prime Numbers Less Than N

List Prime Numbers Less Than N

Given an integer ( n ), your task is to print all the prime numbers that are less than ( n ) in increasing order. A prime number is defined as an integer greater than 1 that has no positive divisors other than 1 and itself. You can use the Sieve of Eratosthenes algorithm to generate the prime numbers efficiently.

For example, if ( n = 10 ), the prime numbers less than 10 are: 2, 3, 5, and 7.

inputFormat

The input is provided via standard input (stdin) as a single integer ( n ) (( 0 \leq n \leq 10^6 )).

outputFormat

Print to standard output (stdout) all prime numbers less than ( n ) separated by a single space. If there are no prime numbers, output an empty line.## sample

0