Group Abstract Group Abstract

Message Boards Message Boards

0
|
5.9K Views
|
3 Replies
|
1 Total Like
View groups...
Share
Share this post:
GROUPS:

What's the procedure for finding two prime's summing to an even number?

Posted 10 years ago

Brute force is unhelpful

POSTED BY: dgdg grgrg
3 Replies

There is a Goldbach conjecture verification project site.

POSTED BY: Udo Krause

I could be mistaken, but I believe some variant of "brute force" is also the answer to the question of the subject heading. Could do this either by checking n-Prime[k] for primality, or by generating random primes less than n and checking n-randomprime. The expected number of checks before getting a hit is something like log n.

POSTED BY: Daniel Lichtblau

Hi,

so you are interested in the Goldbach Conjecture:

A Goldbach number is a positive integer that can be expressed as the sum of two odd primes. Therefore, another statement of Goldbach's conjecture is that all even integers greater than 4 are Goldbach numbers.

You might like this demonstration or this one. See also this.

I understand that you don't want brute force, but this is the only thing I could quickly come up with.

returnPrimes[m_] := Module[{}, k = 1; Reap[While[(k < m && ! PrimeQ[m - Prime[k]]), Sow[{Prime[k + 1], m - Prime[k + 1]}]; k++]]][[2, 1, -1]]

Not very elegant. But even for relatively "large" even numbers, small primes often do the trick.

returnPrimes[\
8709988769876898765876587657476547654609827405987243059872430598734098\
5740329687534059823409657043298675340958234095854365987098741305987032\
9857042398570234985703429867349857203498574365437654689876987698767098\
78]

gives

(*{2039, 870998876987689876587658765747654765460982740598724305987243059\
8734098574032968753405982340965704329867534095823409585436598709874130\
5987032985704239857023498570342986734985720349857436543765468987698769\
876707839}*)

This one:

returnPrimes[
  87099887698768987658765876574765476546098274059872430598724305987340\
9857403296875340598234096570432986753409582340958543659870987413059870\
3298570423985702349857034298673498572034985743098427509843750924387504\
3987650439865900987908645098234750934875043985702349876543765468987698\
7698767098787693929495742454598294582548249592268482684962926946246908\
74098750248957029485704895703498570234985702349857468459876] // \
AbsoluteTiming

runs in less than a third of a second. How large a number are you interested in?

Cheers,

Marco

POSTED BY: Marco Thiel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard