Post Reply 
Goldbach Conjecture 
03-15-2015, 04:45 PM (This post was last modified: 03-19-2015 10:27 AM by DrD.)
Post: #1
Goldbach Conjecture 
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?

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;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Goldbach Conjecture  - DrD - 03-15-2015 04:45 PM
RE:   former rainy day - Teresa - 03-16-2015, 01:10 PM
RE: Goldbach Conjecture  - DrD - 03-18-2015, 04:07 PM
RE: Goldbach Conjecture  - DrD - 03-22-2015, 10:32 AM



User(s) browsing this thread: 1 Guest(s)