# Thread: Write a program in C to Check Whether a Number can be Express as Sum of Two Prime N0

1. ## Write a program in C to Check Whether a Number can be Express as Sum of Two Prime N0

Write a program in C to Check Whether a Number can be Express as Sum of Two Prime Numbers.
Sample Run :
Input a positive integer: 16
Expected Output :
16 = 3 + 13
16 = 5 + 11

2. So where is your attempt?

You can't just roll in, dump your assignment and expect someone to give you an answer on a plate. It doesn't work like that.
http://cboard.cprogramming.com/c-pro...uncements.html

At the very least, you should be capable of reading in the required data into suitable variables.

3. I'm pretty sure this is a theorem of natural numbers.. not proved yet for all N but certainly not in question.. Then what's the point of this program? Just make the program print 'True'.

Even if it did the program actually did prove it for the 32 or 64 bit representable integers on a computer, it would not have any tangible benefit. Also I think you might find even proving it for all 16 bit numbers would take a very, very, long time.

4. Goldbach's conjecture (every even integer greater than 2 is the sum of two primes) has been shown to be true up to 2 to the 62 (about 4 billion billion). Note that it's only for even numbers (since most primes are odd and you're adding two of them together).

5. Wait.. most primes are odd? I thought all primes are odd... cause an even number is divisible by 2, contrary to the definition.. excepting the special cases of 0 and 1, I suppose.

6. Originally Posted by MacNilly
Wait.. most primes are odd? I thought all primes are odd... cause an even number is divisible by 2, contrary to the definition.. excepting the special cases of 0 and 1, I suppose.
2 is the only even prime number. Divisibility by 2 (itself) does not break the criteria for being prime.

7. Originally Posted by MacNilly
Wait.. most primes are odd? I thought all primes are odd... cause an even number is divisible by 2, contrary to the definition.. excepting the special cases of 0 and 1, I suppose.
"Most" is somewhat of an understatement, I guess.

0 and 1 are not considered prime, so 2 is the lowest prime.

8. Then, maybe a better statement, instead of "most primes are odd" is "all primes except 2 are odd".