Goldbach Partition

Author

Eric W. Weisstein
January 4, 2006

This notebook downloaded from http://mathworld.wolfram.com/notebooks/PrimeNumbers/GoldbachPartition.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/GoldbachPartition.html.

©2006 Wolfram Research, Inc. except for portions noted otherwise

R(n)

(Rs=Table[Select[Flatten[Outer[List,Sequence@@Table[Prime[Range[5]],{2}]],1],Plus@@#==n&],{n,2,20,2}])//ColumnForm

Length/@Rs

(rs=Table[Select[Union[Sort/@Flatten[Outer[List,Sequence@@Table[Prime[Range[5]],{2}]],1]],Plus@@#==n&],{n,2,20,2}])//ColumnForm

Length/@rs

MapIndexed[If[PrimeQ[#2[[1]]],2#1-1,2#1]&,Length/@rs]

Enumeration

Into p, q==1 or a prime

s12=Block[{p},Table[Select[Table[{p=If[k==0,1,Prime[k]],2g-p},{k,0,PrimePi[g]}],PrimeQ[#[[2]]]&],{g,20}
]
]

Length/@s12

Into p, q primes

s2=Block[{p},Table[Select[Table[{p=Prime[k],2g-p},{k,PrimePi[g]}],PrimeQ[#[[2]]]&],{g,20}
]
]

Length/@s2

With[{g=100},ListPlot[Table[Count[Table[PrimeQ[2n-Prime[k]],{k,PrimePi[n]}],True],{n,2000}],
PlotStyle->Red,
AxesLabel->TraditionalForm/@{n,r[2n]}]
]//Timing

With[{g=1000},ListPlot[Table[Count[Table[PrimeQ[2n-Prime[k]],{k,PrimePi[n]}],True],{n,2000}],
AxesLabel->TraditionalForm/@{n,p+q==2n}]
]//Timing

With[{g=4000},ListPlot[Table[Count[Table[PrimeQ[2n-Prime[k]],{k,PrimePi[n]}],True],{n,2000}],
AxesLabel->TraditionalForm/@{n,p+q==2n}]
]//Timing

Into 2 odd primes

s=Table[Select[Table[{p=Prime[k],2g-p},{k,2,PrimePi[g]}],PrimeQ[#[[2]]]&],{g,20}
]

Length/@s