Any natural number can be expressed as the sum of , or odd primes. If itself is a prime, only one number is required.
However, because there are so many solutions for large composite , it is your task to find the solution where are prime, and where is as large as possible, or, if cannot be expressed as the sum of two primes, find the solution where are prime and where is as large as possible, followed by where is as large as possible.
Examples
is larger than and so, the required solution is .
In this case, is larger than , and so the required solution is .
The input contains numbers on separate lines. These numbers are less than and larger than . Write a program that will find the sum of primes for each of these numbers as described, and display the result as is shown in the sample below.
Sample Input
49
152029
90118
4565973
705510
Sample Output
49 = 13 + 17 + 19
152029 = 152029
90118 = 44987 + 45131
4565973 = 1521991 + 1521991 + 1521991
705510 = 352753 + 352757
Comments
This comment is hidden due to too much negative feedback. Show it anyway.
IIRC they proved that it holds for at least all
Shouldn't the output for 49 be: 49 = 2 + 47
If you can't express 49 as the sum of two primes, then you go on to try and find three primes. But you can find two primes. So it shouldnt be 13+17 + 19
https://dmoj.ca/problem/ecoo07r3p1#comment-5127
for the first test case isn't it supposed to be 49 = 2 + 47
let the first number as large as possible
But.. the problem statement implies that you should express as a sum of three primes only if you can't express it as a sum of two primes.
IDK tho
lmao rip
fair enough
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
isn't a prime number, and all of , and must be prime.