03-15-2015, 04:45 PM
Here's a short program to display both the number of Goldbach partitions, and a list containing them:
For additional "fun" points, can you graph the number of resulting partitions vs. an even number (greater than 4) that produces a composition of twin prime summands?
For additional "fun" points, can you graph the number of resulting partitions vs. an even number (greater than 4) that produces a composition of twin prime summands?
Code:
//============================================
// Goldbach Conjecture, June 7,1742 =
// =
// Lists the number of Goldbach twin-prime =
// summand pairs, =
// Enter an even number greater than 4 =
// Displays Number of, and List of =
// Goldbach Partitions. =
// =
// ===========================================
EXPORT Gold(n)
BEGIN
local a:=0, i ;
L1:={};
print();
for i from 3 to n do
if isprime(i) and isprime(n-i) then
L1:=concat(L1,{{i,(n-i)}}); // Full Goldbach Composition
a:= a+1 ; // Total number of Goldbach elements
end;
end;
print("Goldbach Partitions " + a/2); // Number of distinct Goldbach partitions
print(L1({1,size(L1)/2})); // Goldbach partition listing
END;