#C14058. Filter Unique Prime Numbers
Filter Unique Prime Numbers
Filter Unique Prime Numbers
You are given a list of integers. Your task is to extract all the prime numbers from the list, remove any duplicates, and then output the unique prime numbers in ascending order.
A number \( n \) is considered prime if it satisfies \( n > 1 \) and for every integer \( d \) with \( 2 \le d \le \sqrt{n} \), we have \( n \mod d \neq 0 \). That is, a number is prime if it has no positive divisors other than 1 and itself.
Example: For the input list 2 3 4 5 3 2 7 8 9 3
, the output should be 2 3 5 7
.
inputFormat
The input is read from standard input (stdin) and consists of two lines.
- The first line contains a single integer \( N \) which represents the number of elements in the list.
- The second line contains \( N \) integers separated by spaces.
If \( N = 0 \), there will be no second line and the list is considered empty.
outputFormat
Output the unique prime numbers in ascending order, separated by a single space, to standard output (stdout). If there are no prime numbers, output nothing.
## sample10
2 3 4 5 3 2 7 8 9 3
2 3 5 7