A Math Contest P11 - Weak Goldbach's Conjecture

View as PDF

Submit solution

Points: 15
Time limit: 1.0s
Memory limit: 256M

Problem type

Given an odd integer N greater than or equal to 7, find three prime numbers that sum to N.

Input Specification

The only line contains an odd integer, N (7 \le N \le 10^{18}).

Output Specification

Output three prime numbers A, B and C, such that A+B+C = N. Since there may be multiple answers, output the lexicographically minimum triplet.

Sample Input


Sample Output

2 2 5

Explanation for Sample

2+2+5 = 9 and both 2 and 5 are prime. Other triplets such as (3, 3, 3) also sum to 9, but (2, 2, 5) is the lexicographically minimum triplet.


There are no comments at the moment.