MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: goldbach prime partitions for arbitrary integer n => 4

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43012] Re: goldbach prime partitions for arbitrary integer n => 4
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Fri, 8 Aug 2003 00:26:26 -0400 (EDT)
  • Organization: The University of Western Australia
  • References: <bgsn4c$nnq$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <bgsn4c$nnq$1 at smc.vnet.net>,
 gilmar.rodriguez at nwfwmd.state.fl.us (Gilmar Rodríguez Pierluissi) 
 wrote:

> If one wishes to compute:
> eqn={p+q==200}; constraints={2<=p<=100, p<=q, p,q \[Element]Primes};
> wouldn't it be nice that if you evaluate:
> Solve[eqn,constraints,{p,q}]
> you would get:
> {{97,103},{73,127},{61,139},{43,157},{37,163},{19,181},{7,193},{3,197}} ?
> A module (or program) that could solve:
> eqn={p+q==n}; constraints={2<=p<=n/2, p<=q, p,q \[Element]Primes};
> Solve[eqn,constraints,{p,q}]
> for a specified n, (n=>4, n \[Element]Integer), would be even better!
> Thank you!

Although others will probably provide more efficient (and general) 
solutions, here is one way to generate the solutions you are after:

  PrimePair[n_Integer] := Select[Table[Prime[i], {i, PrimePi[n/2]}], 
    PrimeQ[n - #] & ] /. p_ :> {p, n - p}

  PrimePair[200]

Cheers,
Paul

-- 
Paul Abbott                                   Phone: +61 8 9380 2734
School of Physics, M013                         Fax: +61 8 9380 1014
The University of Western Australia      (CRICOS Provider No 00126G)         
35 Stirling Highway
Crawley WA 6009                      mailto:paul at physics.uwa.edu.au 
AUSTRALIA                            http://physics.uwa.edu.au/~paul


  • Prev by Date: Re: contour plotting over a non-uniform grid
  • Next by Date: Numerical precision problem
  • Previous by thread: Re: Re: goldbach prime partitions for arbitrary integer n => 4
  • Next by thread: Re: goldbach prime partitions for arbitrary integer n => 4