Given an integer X, the task is to find two integers A and B such that LCM(A, B) = X and the difference between the A and B is minimum possible.
Input: X = 6
Output: 2 3
LCM(2, 3) = 6 and (3 – 2) = 1
which is the minimum possible.
Input X = 7
Output: 1 7
Approach: An approach to solve this problem is to find all the factors of the given number using the approach discussed in this article and then find the pair (A, B) that satisfies the given conditions and has the minimum possible differecne.
Below is the implementation of the above approach:
- Find the minimum difference between Shifted tables of two numbers
- Pair of prime numbers with a given sum and minimum absolute difference
- Find two Composite Numbers such that there difference is N
- Find an index such that difference between product of elements before and after it is minimum
- Program to find the percentage of difference between two numbers
- Find two numbers made up of a given digit such that their difference is divisible by N
- Program to find the maximum difference between the index of any two different numbers
- Find Maximum and Minimum of two numbers using Absolute function
- Remove minimum numbers from the array to get minimum OR value
- Absolute difference between the Product of Non-Prime numbers and Prime numbers of an Array
- Absolute Difference between the Sum of Non-Prime numbers and Prime numbers of an Array
- Minimum absolute difference between N and a power of 2
- Co-prime pair with given sum minimum difference
- Minimum difference between any two primes from the given range
- Divide 1 to n into two groups with minimum sum difference
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.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.