#K71802. 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 number \(p\) is a prime if and only if it is greater than 1 and has no positive divisors other than 1 and itself.
For example, for the input list [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], the prime numbers are [2, 3, 5, 7].
inputFormat
The first line contains a single integer \(n\) indicating the number of elements in the list. The second line contains \(n\) space-separated integers.
outputFormat
Output the prime numbers from the input list in the same order as they appear, separated by a single space. If there are no prime numbers, output nothing.
## sample10
1 2 3 4 5 6 7 8 9 10
2 3 5 7