#P1304. Goldbach Conjecture Verification
Goldbach Conjecture Verification
Goldbach Conjecture Verification
Given an even number N, verify Goldbach's conjecture for every even number from 4 to N. Goldbach's conjecture states that every even number greater than 2 can be expressed as the sum of two prime numbers. For each even number in the range, if there exists more than one valid partition into two primes, you must output the partition in which the first addend is the smallest among all possibilities. For example, for 10 there are two representations: 10 = 3 + 7 and 10 = 5 + 5. Since 3 is smaller than 5, the correct output is 10 = 3 + 7.
Your task is to, given input N, output for every even number from 4 to N (inclusive) a line in the format:
X=P+Q
where X is the even number and P and Q are primes such that P + Q = X and P is as small as possible among all valid representations.
inputFormat
The input consists of a single line containing an even integer N (N ≥ 4).
outputFormat
For each even number X in the range [4, N] (stepping by 2), print one line in the format "X=P+Q", where P and Q are prime numbers such that P + Q = X and P is minimized among all valid decompositions for X.
sample
10
4=2+2
6=3+3
8=3+5
10=3+7
</p>