#C13999. Prime Number Processing
Prime Number Processing
Prime Number Processing
You are given a list of integers. Your task is to extract all the prime numbers from the list and then compute both the sum and the count of these primes.
A prime number is defined as an integer 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 all integers \(a\) and \(b\) such that \(n = a \times b\), either \(a = 1\) or \(b = 1\).
Process the input provided via standard input and output the results to standard output.
inputFormat
The first line of input contains a single integer \(n\) which represents the number of integers in the list. The second line contains \(n\) space-separated integers.
Example:
7 1 2 3 4 5 10 17
outputFormat
The output consists of two lines:
- The first line contains the prime numbers extracted from the list in their original order, separated by a single space. If there are no prime numbers, output an empty line.
- The second line contains two integers separated by a space: the sum of the prime numbers and the count of prime numbers.
Example:
2 3 5 17 27 4## sample
7
1 2 3 4 5 10 17
2 3 5 17
27 4
</p>