#C12304. Prime Frequencies
Prime Frequencies
Prime Frequencies
You are given a list of integers. Your task is to identify all the prime numbers in the list, count their frequencies, and then output each prime paired with its frequency. The resulting list of pairs should be sorted in ascending order by the prime number.
A prime number is defined as an integer greater than 1 that has no divisors other than 1 and itself. In mathematical terms, for each prime \(p\), let \(f(p)\) be its frequency in the list. You are required to output the list of pairs \((p, f(p))\) for all primes \(p\) found in the input.
inputFormat
The input is given via standard input (stdin). The first line contains a single integer \(n\), which represents the number of integers in the list. The second line contains \(n\) space-separated integers.
outputFormat
Output the prime numbers and their frequencies to standard output (stdout), one pair per line. Each line should contain two integers: the prime number and its frequency, separated by a space. If no primes are found, output nothing.
## sample11
7 3 5 7 3 2 7 11 5 13 2
2 2
3 2
5 2
7 3
11 1
13 1
</p>