#K50332. Sieve of Eratosthenes: Generate All Primes Below n
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.
## sample10
2 3 5 7
</p>