#C14585. Filter Prime Numbers
Filter Prime Numbers
Filter Prime Numbers
You are given a list of integers. Your task is to output only those integers that are prime numbers. A prime number is defined as a natural number greater than 1 that has no positive divisors other than 1 and itself. In other words, a number n is prime if it satisfies:
$$n > 1$$
and for every integer $$a$$ such that $$2 \leq a \leq \sqrt{n},$$ it holds that $$n \bmod a \neq 0.$$
If no prime numbers are found in the list, output an empty line.
inputFormat
The input is read from standard input. The first line contains an integer $$n$$ representing the number of elements in the list. The second line contains $$n$$ space-separated integers.
outputFormat
Output to standard output a single line containing the prime numbers from the list, separated by a space. If there are no prime numbers, output an empty line.## sample
10
2 3 4 5 6 7 8 9 10 11
2 3 5 7 11