Re: goldbach prime partitions for arbitrary integer n => 4
- To: mathgroup at smc.vnet.net
- Subject: [mg43018] Re: [mg42986] goldbach prime partitions for arbitrary integer n => 4
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Fri, 8 Aug 2003 00:26:31 -0400 (EDT)
- References: <200308070453.AAA24088@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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! You can use Reduce in version 5. eqn = {p+q==200}; constraints = {2<=p<=100, p<=q, Element[{p,q},Primes]}; InputForm[Reduce[Join[eqn,constraints], {p,q}]] Out[3]//InputForm= (p | q) \[Element] Primes && C[1] \[Element] Integers && Inequality[2, LessEqual, C[1], LessEqual, 100] && p == C[1] && q == 200 - C[1] The trick is to realize that there is a relatively low bound on how many discrete solutions are allowed by default (it is 10). If you do Developer`SetSystemOptions["ReduceOptions" -> {"DiscreteSolutionBound" ->100}]; then we get something more along the lines desired. InputForm[Reduce[Join[eqn,constraints], {p,q}]] Out[5]//InputForm= (p == 3 && q == 197) || (p == 7 && q == 193) || (p == 19 && q == 181) || (p == 37 && q == 163) || (p == 43 && q == 157) || (p == 61 && q == 139) || (p == 73 && q == 127) || (p == 97 && q == 103) Daniel lichtblau Wolfram Research
- Follow-Ups:
- Re: Re: goldbach prime partitions for arbitrary integer n => 4
- From: Dr Bob <drbob@bigfoot.com>
- Re: Re: goldbach prime partitions for arbitrary integer n => 4
- References:
- goldbach prime partitions for arbitrary integer n => 4
- From: gilmar.rodriguez@nwfwmd.state.fl.us (Gilmar Rodríguez Pierluissi)
- goldbach prime partitions for arbitrary integer n => 4