#K81952. Descending Prime Filter
Descending Prime Filter
Descending Prime Filter
Given a list of integers, your task is to filter out all the prime numbers and output them in descending order. A prime number is a number greater than 1 that has no positive divisors other than 1 and itself. In mathematical terms, a number \( n \) is prime if \( n > 1 \) and for every integer \( k \) such that \( 1 < k < n \), we have \( n \mod k \neq 0 \).
Read the list of numbers from standard input and write the result to standard output.
inputFormat
The first line contains an integer \( n \) (\( 1 \leq n \leq 10^5 \)) representing the number of elements in the list.
The second line contains \( n \) integers separated by spaces. Each integer will be in the range of \( -10^9 \) to \( 10^9 \).
outputFormat
Output the prime numbers found in the list in descending order, separated by a single space.
If no prime number exists, output an empty line.
## sample9
2 3 4 5 6 7 8 9 10
7 5 3 2