#C14025. Filter Prime Numbers
Filter Prime Numbers
Filter Prime Numbers
Given a list of integers, your task is to filter out and print only the prime numbers from the list. A number \( n \) is considered prime if it is greater than 1 and has no positive divisors other than 1 and itself. In other words, \( n \) is prime if for every integer \( a \) where \( 2 \leq a \leq \sqrt{n} \), \( n \) is not divisible by \( a \).
You need to read the input from standard input and write the output to standard output.
inputFormat
The input consists of two lines:
- The first line contains a single integer \( n \) representing the number of elements in the list.
- The second line contains \( n \) space-separated integers.
outputFormat
Output a single line containing the prime numbers from the input list separated by a space. If there are no prime numbers, output an empty line.
## sample9
2 3 4 5 6 7 8 9 10
2 3 5 7