Count common elements in two arrays containing multiples of N and M | Recursive function to find gcd using euclidean algorithm ; Function to find lcm of two numbers using gcd ; Driver code
def gcd ( a , b ) : NEW_LINE INDENT if ( a == 0 ) : NEW_LINE INDENT return b ; NEW_LINE DEDENT return gcd ( b % a , a ) ; NEW_LINE DEDENT def lcm ( n , m ) : NEW_LINE INDENT return ( n * m ) // gcd ( n , m ) ; NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT n = 2 ; m = 3 ; k = 5 ; NEW_LINE print ( k // lcm ( n , m ) ) ; NEW_LINE DEDENT