Question: Prime sum question

According to this site,"It is known that every even number can be written as a sum of at most six primes". 

http://www.theage.com.au/national/education/christians-goldbachs-magic-sum-20140903-3es2t.html

i wanted to test this using maple.

restart:
> PF := proc (a::integer)

> local cst,obj,res;
> cst := add(x[i], i = 1 .. numtheory:-pi(prevprime(a))) <= 6;
> obj := add(x[i]*ithprime(i), i = 1 .. numtheory:-pi(prevprime(a)))-a;
> res := Optimization:-LPSolve(obj, {cst ,obj>=0}, assume={nonnegative,integer}); end proc:
> PF(30);
[0, [x[1] = 0, x[2] = 0, x[3] = 6, x[4] = 0, x[5] = 0, x[6] = 0,x[7] = 0, x[8] = 0, x[9] = 0, x[10] = 0]]

the third prime is 5 and 6 of them make 30. as an aside, it would be nice to know how to get maple to output "30 = 6x5".

this is obviously pretty limited, because 30 can be written as the sum of two primes (7+23 and 11+19) [GOLDBACH], but using DS's GlobalSearch for all solutions takes a long time to compute. also I have to nominate the highest prime.

any suggestions?

Please Wait...