#C12659. Prime Number Filter

    ID: 42110 Type: Default 1000ms 256MiB

Prime Number Filter

Prime Number Filter

Given a list of integers, write a program to filter out only the prime numbers from the list. 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 \(p\) is prime if and only if for every integer \(a\) with \(1 < a < p\), \(p \mod a \neq 0\).

The output should display the prime numbers in the same order as they appear in the input. If there are no prime numbers, output an empty line.

inputFormat

The first line contains an integer (n), representing the number of elements. The second line contains (n) space-separated integers.

outputFormat

Print the filtered prime numbers separated by a single space. If there are no prime numbers, print an empty line.## sample

7
2 3 5 7 11 13 17
2 3 5 7 11 13 17

</p>