LCM of large numbers in python
<p>I'm using the formula &quot;product of two number is equal to the product of their GCD and LCM&quot;.</p>
<p>Here's my code :</p>
<pre><code># Uses python3

import sys

def hcf(x, y):

    while(y):
        x, y = y, x % y

    return x

a,b = map(int,sys.stdin.readline().split())

res=int(((a*b)/hcf(a,b)))
print(res)
</code></pre>
<p>It works great for small numbers. But when i give input as :</p>
<blockquote>
<p>Input:
226553150 1023473145</p>
<p>My output:
46374212988031352</p>
<p>Correct output:
46374212988031350</p>
</blockquote>
<p>Can anyone please tell me where am I going wrong ?</p>