#K43982. Prime Pairs Sum Problem

    ID: 27430 Type: Default 1000ms 256MiB

Prime Pairs Sum Problem

Prime Pairs Sum Problem

Given an even integer ( n ), your task is to find all unique pairs of prime numbers ( (p, q) ) such that ( p \leq q ) and ( p + q = n ). The algorithm should first generate all prime numbers up to ( n ) using the Sieve of Eratosthenes, and then determine the pairs that satisfy the condition.

Note: The output should first print the number of valid prime pairs, followed by each pair on a new line in the format (p, q).

inputFormat

The input is read from the standard input (stdin) as a single integer ( n ) (an even number).

outputFormat

The output is printed to the standard output (stdout). The first line contains the count of prime pairs. Each subsequent line contains a prime pair in the format (p, q).## sample

10
2

(3, 7) (5, 5)

</p>