#C14060. Filter Prime Numbers
Filter Prime Numbers
Filter Prime Numbers
Given a list of integers, your task is to filter out and output only the prime numbers. A prime number is defined as an integer \(p\) such that \(p > 1\) and its only positive divisors are 1 and \(p\). Note that negative numbers, 0, and 1 are not considered prime. The filtered prime numbers should be output in the order in which they appear in the input.
inputFormat
The input is read from stdin
and consists of two lines:
- The first line contains a single integer \(N\) (\(0 \le N \le 10^5\)), which represents the number of integers.
- The second line contains \(N\) space-separated integers.
outputFormat
Output the filtered prime numbers in a single line to stdout
. Each prime number should be separated by a single space. If there are no prime numbers in the list, output an empty line.
6
3 4 -1 7 10 13
3 7 13
</p>