Goldbach’s conjecture is one of the oldest and best-known unsolved problems in number theory of mathematics. Every even integer greater than 2 can be expressed as the sum of two primes.
Input : n = 44 Output : 3 + 41 (both are primes) Input : n = 56 Output : 3 + 53 (both are primes)
- Find the prime numbers using Sieve of Sundaram
- Check if entered number is an even number greater than 2 or not, if no return.
- If yes, then one by one subtract a prime from N and then check if the difference is also a prime, if yes then express it as a sum.
2 + 2 = 4 7 + 31 = 38 3 + 97 = 100
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.
This article is contributed by Sahil Chhabra (akku). If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Count primes that can be expressed as sum of two consecutive primes and 1
- Count of primes below N which can be expressed as the sum of two primes
- Nth Term of a Fibonacci Series of Primes formed by concatenating pairs of Primes in a given range
- Length of largest sub-array having primes strictly greater than non-primes
- Program to implement Collatz Conjecture
- Lemoine's Conjecture
- Ramanujan–Nagell Conjecture
- Legendre's Conjecture
- Triangle of numbers arising from Gilbreath's conjecture
- Maximum Sequence Length | Collatz Conjecture
- Goldbach's Weak Conjecture for Odd numbers
- Check if an integer can be expressed as a sum of two semi-primes
- Check if all nodes of the Binary Tree can be represented as sum of two primes
- Minimum difference between any two primes from the given range
- Sum of all Primes in a given range using Sieve of Eratosthenes
- Maximum Primes whose sum is equal to given N
- Count the number of primes in the prefix sum array of the given array
- Count of primes in a given range that can be expressed as sum of perfect squares
- Prime points (Points that split a number into two primes)
- Find Square Root under Modulo p | (When p is product of two primes in the form 4*i + 3)