#C14716. Prime Number Generator

    ID: 44396 Type: Default 1000ms 256MiB

Prime Number Generator

Prime Number Generator

You are given a positive integer n. Your task is to compute all prime numbers less than n using the Sieve of Eratosthenes algorithm. Recall that a prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself.

The Sieve of Eratosthenes works by iteratively marking the multiples of each prime number starting from 2. The time complexity of the algorithm is \(O(n \log \log n)\), which is efficient for moderately large values of n.

For example, if n is 10, then the prime numbers less than 10 are: 2, 3, 5, and 7.

inputFormat

The input consists of a single integer n (where n \(\geq 0\)). This integer is provided via standard input.

outputFormat

Output all prime numbers less than n in ascending order, separated by a single space. If there are no prime numbers, output an empty line.

## sample
10
2 3 5 7