TCCC October '24 P3 - Goldbach Conjecture

View as PDF

Submit solution

Points: 7 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

The Goldbach Conjecture is an unproven problem in mathematics which states that every even natural number greater than 2 is the sum of two prime numbers. Most numbers have more than 1 pair of primes that satisfy this statement. Given an even number greater than 2, list all pairs of primes that add up to this number.

Input Specification

The only line of input is an even integer N (4 \le N \le 1000).

Output Specification

Output every unique pair of primes that add up to the number inputted, each on a new line, formatted with brackets and commas.

Note: Prime pairs should be listed in increasing order of the first prime, and inversely in decreasing order of the second prime.

Sample Input

72

Sample Output

(5, 67)
(11, 61)
(13, 59)
(19, 53)
(29, 43)
(31, 41)

Sample Explanation

The even number 72 is inputted. Each pair of primes that add up to 72 is listed, the primes on the left increasing in order, and the primes on the right decreasing in order.


Comments

There are no comments at the moment.