![]() |
VOOZH | about |
Goldbach's conjecture is one of the oldest and best-known unsolved problems in the number theory of mathematics. Every even integer greater than 2 can be expressed as the sum of two primes.
Examples:
Input : n = 44 Output : 3 + 41 (both are primes) Input : n = 56 Output : 3 + 53 (both are primes)
Approach: 1
Below is the implementation of the above approach:
2 + 2 = 4 7 + 31 = 38 3 + 97 = 100
Time Complexity: O(n log n)
Auxiliary Space: O(MAX)
A Goldbach number is a positive integer that can be expressed as the sum of two odd primes. Since four is the only even number greater than two that requires the even prime 2 in order to be written as the sum of two primes, another form of the statement of Goldbach's conjecture is that all even integers greater than 4 are Goldbach numbers.