#C7792. Sieve of Eratosthenes
Sieve of Eratosthenes
Sieve of Eratosthenes
Given an integer \( n \), compute all prime numbers less than or equal to \( n \) using the Sieve of Eratosthenes algorithm. The algorithm iteratively marks the multiples of each prime number starting from \(2\), ensuring only prime numbers remain.
The expected time complexity is \(O(n \log \log n)\). Your task is to implement this sieve to output the prime numbers in increasing order.
inputFormat
The input consists of a single integer \( n \) on a single line from standard input (stdin).
outputFormat
Output all prime numbers less than or equal to \( n \) in increasing order on one line, separated by a single space. If there are no prime numbers, output an empty line.
## sample1