Problems > The First N Primes

The First N Primes

Difficulty: 1000 2000 ms 128 MB

math

Print the first N prime numbers.

Input: one integer N.

Output: the first N primes on one line.

Constraints:

  • 1 ≤ N ≤ 1000

Sample Tests

Input 1
5
Output 1
2 3 5 7 11
Input 2
1
Output 2
2

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.