Control C501A

Your task is to write a program that, for each nn given, prints the nn smallest first prime numbers.

Input

The input is a sequence of natural numbers nn with 1n10001 \le n \le 1000.

Output

For each nn, print a line with the nn first prime numbers, in increasing order, and separated by a comma.

Observation

Before reading any nn, do a sieve of Eratosthenes to precalculate the first 1000 prime numbers. Knowing that 7919 is the prime number 1000 could be useful.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:15:58.552Z

© Jutge.org, 2006–2026.
https://jutge.org