#K90817. Count Twin Primes
Count Twin Primes
Count Twin Primes
You are given an integer n. Your task is to count the number of twin prime pairs, where a twin prime pair is defined as two prime numbers \(p\) and \(q\) such that \(q - p = 2\) and \(q \le n\). For example, the pair (3, 5) is a twin prime because both 3 and 5 are prime, and \(5 - 3 = 2\).
Input: A single integer n from standard input.
Output: Output a single integer representing the number of twin prime pairs \((p, q)\) satisfying the conditions.
Example:
Input: 10 Output: 2
inputFormat
The input consists of a single integer n (\(n \ge 2\)). This integer is provided via standard input.
outputFormat
Output a single integer to standard output, which is the number of twin prime pairs \((p, q)\) such that \(q - p = 2\) and \(q \le n\).
## sample10
2