#K11051. Count Prime Ages Greater than X
Count Prime Ages Greater than X
Count Prime Ages Greater than X
You are given a list of ages. Your task is to count how many ages are strictly greater than a given threshold X and are also prime numbers. A number \(p\) is said to be prime if \(p > 1\) and it has no positive divisors other than 1 and itself. In other words, for every integer \(a\) satisfying \(2 \le a \le \sqrt{p}\), it must hold that \(a \nmid p\).
The input is provided via standard input (stdin) and the output should be written to standard output (stdout). Make sure your solution efficiently checks for prime numbers, especially when dealing with larger inputs.
inputFormat
The first line contains two space-separated integers \(N\) and \(X\), where \(N\) is the number of ages and \(X\) is the threshold value. The second line contains \(N\) space-separated integers, representing the ages.
Example:
6 10 11 14 17 18 19 21
outputFormat
Output a single integer representing the count of ages that are greater than \(X\) and are prime numbers.
Example:
3## sample
6 10
11 14 17 18 19 21
3