#K8846. Generate First N Primes

    ID: 37313 Type: Default 1000ms 256MiB

Generate First N Primes

Generate First N Primes

Given a single integer (n), output the first (n) prime numbers. A prime number is defined as a natural number greater than 1 that has no positive divisors other than 1 and itself. For example, when (n = 5), the output should be: 2, 3, 5, 7, and 11. Input and output operations must be handled via standard input (stdin) and standard output (stdout). Ensure that if (n \le 0), the program outputs an empty line.

inputFormat

The input consists of a single integer (n) on one line which specifies the number of prime numbers to generate. If (n \le 0), no prime numbers should be printed.

outputFormat

Print the first (n) prime numbers on one line, separated by single spaces. If (n \le 0), output an empty line.## sample

1
2

</p>