Control C501A

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

Input

The input is a sequence of natural numbers n with 1 ≤ n ≤ 1000.

Output

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

Observation

Before reading any n, 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
