#K50332. Sieve of Eratosthenes: Generate All Primes Below n

    ID: 28841 Type: Default 1000ms 256MiB

Sieve of Eratosthenes: Generate All Primes Below n

Sieve of Eratosthenes: Generate All Primes Below n

Given an integer \(n\), your task is to output all prime numbers less than \(n\) using the Sieve of Eratosthenes algorithm. The Sieve of Eratosthenes is an efficient method for finding all primes up to a given limit.

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

inputFormat

The input consists of a single integer \(n\) provided via standard input (stdin).

outputFormat

Output the list of prime numbers less than \(n\) in ascending order, separated by a single space. If there are no primes, output an empty line.

## sample
10
2 3 5 7

</p>