LCM of two large numbers | Python3 program to find LCM of two large numbers ; Function to calculate LCM of two large numbers ; Convert string ' a ' and ' b ' into Integer ; Calculate multiplication of both integers ; Calculate gcd of two integers ; Calculate lcm using formula : lcm * gcd = x * y ; Driver Code ; Input ' a ' and ' b ' are in the form of strings
import math NEW_LINE def lcm ( a , b ) : NEW_LINE INDENT s = int ( a ) NEW_LINE s1 = int ( b ) NEW_LINE mul = s * s1 NEW_LINE gcd = math . gcd ( s , s1 ) NEW_LINE lcm = mul // gcd NEW_LINE return lcm NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT a = "36594652830916364940473625749407" NEW_LINE b = "448507083624364748494746353648484939" NEW_LINE print ( lcm ( a , b ) ) NEW_LINE DEDENT