I am trying to implement an LCM finding algorithm. It needs to find LCM for very large numbers.
LCM is found using the formula,
LCM(A, B) = (A * B) / GCD(A, B)
where A and B are two inputs.
Input: 226553150 1023473145
So, LCM = (226553150 * 1023473145) / 5
It should be, 46374212988031350
.
But python is finding this as 46374212988031352
, which is obviously an error.
How to solve this problem ?