#C12615. Generate the First n Prime Numbers
Generate the First n Prime Numbers
Generate the First n Prime Numbers
You are tasked with generating the first n prime numbers. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. In this problem, if the given integer n is less than 1, you should output nothing.
The method to check if a candidate number x is prime involves verifying that no prime number p exists such that \(p^2 \le x\) and \(p\) divides \(x\) evenly.
Read the integer n from standard input and print the first n prime numbers in one line separated by a single space.
inputFormat
The input consists of a single integer n (which may be negative or zero), representing the number of prime numbers to output.
Input Format:
n
outputFormat
If n is less than 1, output nothing. Otherwise, output the first n prime numbers in one line, separated by a single space.
## sample0