+ 7

# Challenge 🏆🏆 Represent a composite number as a sum of two prime numbers.

Its a proof that any composite number can be represented as the sum of two prime number. eg. 8 = 5+3; 22 = 19 + 3; or 17 + 5; Your program should find all the pairs of prime numbers whose sum is equal to n where n is any composite number.

9 odpowiedzi

+ 27

https://code.sololearn.com/czTIFjtzn23y/?ref=app

+ 13

Not every composite number is the sum of two primes. Counterexamples: Every odd composite number n, such that n-2 is not prime (27, 35, 51...).
We actually don't know whether every even number bigger than two is the sum of two primes. Every number we looked at has that property, but that does not constitute a proof, as we only checked for a finite subset of an infinite set of numbers.
https://en.m.wikipedia.org/wiki/Goldbach%27s_conjecture

+ 4

fixed
And now works better
https://code.sololearn.com/cJmrEXAB26e9/?ref=app

+ 3

https://code.sololearn.com/crMUlLUT6Uqw/?ref=app

+ 3

+ 3

here's the most straightforward version I could make in c++ :
https://code.sololearn.com/c9ooluWHmO42/?ref=app

+ 2

https://code.sololearn.com/clD3j87zJXPw/?ref=app

- 2

11 + 11 is also equal to 22