Lemoine’s Conjecture
Any odd integer greater than 5 can be expressed as a sum of an odd prime (all primes other than 2 are odd) and an even semiprime. A semiprime number is a product of two prime numbers. This is called Lemoine’s conjecture.
Examples :
7 = 3 + (2 × 2),
where 3 is a prime number (other than 2) and 4 (= 2 × 2) is a semiprime number.11 = 5 + (2 × 3)
where 5 is a prime number and 6(= 2 × 3) is a semiprime number.9 = 3 + (2 × 3) or 9 = 5 + (2 × 2)
47 = 13 + 2 × 17 = 37 + 2 × 5 = 41 + 2 × 3 = 43 + 2 × 2
C++
// C++ code to verify Lemoine's Conjecture // for any odd number >= 7 #include<bits/stdc++.h> using namespace std; // Function to check if a number is // prime or not bool isPrime(int n) { if (n < 2) return false; for (int i = 2; i <= sqrt(n); i++) { if (n % i == 0) return false; } return true; } // Representing n as p + (2 * q) to satisfy // lemoine's conjecture void lemoine(int n) { // Declaring a map to hold pairs (p, q) map<int, int> pr; // Declaring an iterator for map map<int, int>::iterator it; it = pr.begin(); // Finding various values of p for each q // to satisfy n = p + (2 * q) for (int q = 1; q <= n / 2; q++) { int p = n - 2 * q; // After finding a pair that satisfies the // equation, check if both p and q are // prime or not if (isPrime(p) && isPrime(q)) // If both p and q are prime, store // them in the map pr.insert(it, pair<int, int>(p, q)); } // Displaying all pairs (p, q) that satisfy // lemoine's conjecture for the number 'n' for (it = pr.begin(); it != pr.end(); ++it) cout << n << " = " << it->first << " + (2 * " << it->second << ")\n"; } // Driver Function int main() { int n = 39; cout << n << " can be expressed as " << endl; // Function calling lemoine(n); return 0; } // This code is contributed by Saagnik Adhikary |
Output :
39 can be expressed as : 39 = 5 + (2 * 17) 39 = 13 + (2 * 13) 39 = 17 + (2 * 11) 39 = 29 + (2 * 5)
Recommended Posts:
- Legendre's Conjecture
- Ramanujan–Nagell Conjecture
- Program for Goldbach’s Conjecture (Two Primes with given Sum)
- Program to implement Collatz Conjecture
- Triangle of numbers arising from Gilbreath's conjecture
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Print all the permutation of length L using the elements of an array | Iterative
- Sum of N terms in the expansion of Arcsin(x)
- Minimize the cost of buying the Objects
- Count of all possible pairs of disjoint subsets of integers from 1 to N
- Right most non-zero digit in multiplication of array elements
- Find the remainder when First digit of a number is divided by its Last digit
- Find the remaining balance after the transaction
- Count of integers that divide all the elements of the given array
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : SaagnikAdhikary



