#K3436. Prime Fish Filter
Prime Fish Filter
Prime Fish Filter
You are given an integer N
which denotes the number of fish, followed by a sequence of N
integers representing the sizes of the fish. Your task is to output all fish sizes that are prime numbers in the same order as they appear in the input.
A prime number is a positive integer greater than 1 that has no divisors other than 1 and itself. Formally, a number p is prime if and only if \[ p > 1 \quad \text{and} \quad \forall d \in \mathbb{Z},\; 1 < d < p \implies d \nmid p \]
For example, if the fish sizes are [4, 6, 7, 10, 11, 13], then the prime numbers are [7, 11, 13].
inputFormat
The first line of input contains an integer N
(the number of fish). The second line contains N
space-separated integers representing the sizes of the fish.
outputFormat
Print on a single line the fish sizes that are prime numbers, in the order they appear in the input, separated by a single space. If there are no prime sizes, output an empty line.
## sample6
4 6 7 10 11 13
7 11 13