#C13726. First N Primes

    ID: 43296 Type: Default 1000ms 256MiB

First N Primes

First N Primes

You are given a non-negative integer (n). Your task is to compute the first (n) prime numbers and print them as space-separated values on a single line.

A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Formally, a number (p) is prime if for all integers (a) such that (2 \leq a \leq \sqrt{p}), (a) does not divide (p).

For example:

  • If \(n = 0\), you should output nothing.
  • If \(n = 1\), the output is: 2.
  • If \(n = 5\), the output is: 2 3 5 7 11.
Your solution should read from standard input (stdin) and write to standard output (stdout).

inputFormat

The input consists of a single line containing one non-negative integer (n) (where (0 \leq n \leq 10^5)) which represents the number of prime numbers to generate.

outputFormat

Output the first (n) prime numbers in order, separated by a single space. If (n = 0), output nothing.## sample

0