#K11651. Prime Numbers Generation

    ID: 23516 Type: Default 1000ms 256MiB

Prime Numbers Generation

Prime Numbers Generation

Given a positive integer n, output all prime numbers less than n in increasing order. A prime number is defined as a natural number greater than 1 that has no positive divisors other than 1 and itself. One efficient method for solving this problem is the Sieve of Eratosthenes. The Sieve of Eratosthenes algorithm works in O(n \log\log n) time complexity and is ideal for generating a list of prime numbers.

Task: Write a program that reads an integer from stdin and prints all the prime numbers strictly less than this number to stdout. The output should display the prime numbers separated by a single space. If there are no prime numbers, print an empty line.

inputFormat

The input consists of a single integer n (where n is a positive integer), read from standard input.

outputFormat

Print all prime numbers less than n in increasing order, separated by a single space. If no prime numbers exist, output an empty line.

## sample
10
2 3 5 7

</p>