#K86807. Prime Number Filter
Prime Number Filter
Prime Number Filter
Given a list of integers, your task is to filter out and print all the prime numbers from the list. A number \(n\) is considered prime if and only if \(n > 1\) and it has no divisors other than 1 and itself. In other words, if \(n\) is not prime, then there exists an integer divisor \(d\) such that \(2 \leq d \leq \sqrt{n}\) and \(d\) divides \(n\) evenly.
inputFormat
The input is read from standard input (stdin). 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 the prime numbers in the order they appear in the list, separated by a single space. If there are no prime numbers, output an empty line.## sample
8
10 15 3 7 8 23 42 67
3 7 23 67