VOOZH about

URL: https://www.geeksforgeeks.org/dsa/minimum-possible-value-of-maxa-b-such-that-lcma-b-c/

⇱ Minimum possible value of max(A, B) such that LCM(A, B) = C - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Minimum possible value of max(A, B) such that LCM(A, B) = C

Last Updated : 12 Jul, 2025

Given an integer C, the task is to find the minimum possible value of max(A, B) such that LCM(A, B) = C.
Examples: 
 

Input: C = 6 
Output:
max(1, 6) = 6 
max(2, 3) = 3 
and min(6, 3) = 3
Input: C = 9 
Output:
 


 


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 take the overall minimum of the maximum of these pairs.
Below is the implementation of the above approach: 
 


Output: 
3

 
Comment
Article Tags:
Article Tags: