#C14315. Prime Number Extraction
Prime Number Extraction
Prime Number Extraction
You are given a list of integers. Your task is to extract all the prime numbers from this list and print them in the order they appear. A prime number is defined as a natural number greater than 1 that has no positive divisors other than 1 and itself. Formally, a number \( n \) is prime if \( n > 1 \) and for every integer \( d \) satisfying \( 2 \le d \le \sqrt{n} \), \( d \) does not divide \( n \) evenly.
If there are no prime numbers in the list, output an empty line.
inputFormat
The input is read from standard input (stdin) and has the following format:
- 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
Print the extracted prime numbers from the list in the same order as they appear in the input. The numbers should be separated by a single space. If there are no primes, print an empty line.
## sample10
1 2 3 4 5 6 7 8 9 10
2 3 5 7