I'm trying to I get the list of n
multiples of a
and b
without duplicates? something like this:
M(x, n) + M(y, n) - M(LCM(x, y), n)
where:
M(x, n)
is the list of n
multiplex of x
and
LCM()
Least common multiple
M(LCM(x, y), n)
is supposed to remove all the duplicates which are the numbers in the list multiple of a
and b
at same time. For example:
A = M(3, 5) = {3, 6, 9, 12, 15}
B = M(5, 5) = {5, 10, 15, 20, 25}
L = LCM(3, 5) = (3 * 5) div gcd(3, 5)= 15 div 1 = 15
C = M(L, 5) = {15, 30, 45, 60, 75}
and then:
R = A + B = {3, 6, 9, 12, 15, 5, 10, 15, 20, 25}
R = R - C = {3, 6, 9, 12, 15, 20, 25}
I hope this is clear. If it isn't, tell me please so I can try clarify. I'm Sorry for such a math notation and tags. I don't know how to use it. I'm starting with maths and trying to solve a programming chanllange.