>I've been stuck here for a while now...
So basically you don't know how to calculate a prime number?
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
Start by working out a way of enumerating the prime numbers. If you don't know what the prime numbers below your entered number are, you can't solve the problem. Personally, I would probably create an array of primes to save myself the trouble of calculating them. However, you might want to calculate them, which reduces the current problem from "find two primes that add up to N" to "list all of the primes from 0 to N". That's a much more common problem that you can do research on.
Once you have the primes, it's not terribly difficult to walk over them, take the sum, and compare it with N.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
> Maybe an even number adds up to 3 primes summed up or even more?
The sum of 3 odd numbers will always be odd, like the sum of two odd numbers will be even.
What you're suggesting is there are other primes which are even.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
First I have a question: Is there a mistake? Maybe an even number adds up to 3 primes summed up or even more?
a mistake where? in Goldbach's Conjecture? if you've found a mistake there, get ready for publication in the journals.
an even number can only be the sum of three primes, if one of those primes is the number 2. which isn't saying anything that the Conjecture isn't already saying. because if you subtract 2 from each side of the equation, you have the original conjecture: "even numbers greater than 2 can be expressed as the sum of two prime numbers"
and i suppose an even number (greater than 6) can be expressed by the sum of four primes because every even number greater than 6 can be expressed as the sum of two even numbers greater than 2.
which brings us back full circle, back to Mr. Goldbach.
the point is that (as far as anyone has ever calculated) ALL even numbers >2 are the sum of two prime numbers.
4 = 2 + 2
6 = 3 + 3
8 = 5 + 3
10 = 5 + 5 or 7 + 3
12 = 5 + 7
14 = 7 + 7 or 11 + 3
16 = 11 + 5 or 13 + 3
18 = 13 + 5 or 11 + 7
20 = 13 + 7
22 = 17 + 5 or 11 + 11
24 = 17 + 7 or 13 + 11
26 = 19 + 7 or 13 + 13
28 = 23 + 5 or 17 + 11
30 = 23 + 7 or 17 + 13
32 = 29 + 3 or 19 + 13
34 = 17 + 17 or 29 + 5 or 31 + 3
36 = 19 + 17 or 29 + 7
38 = 19 + 19 or 31 + 7
40 = 23 + 17 or 29 + 11 or 37 + 3
etc.
I prolly missed a few. but you get the idear.
FYI, here's a tidy list of the first 1000 prime numbers: http://primes.utm.edu/lists/small/1000.txt
.
jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179