News for hackers. Stuff that matters.
Re:Project Euler 001 the Hard Way by FabHK on Sunday February 02, 2020 @09:54AM (#22217166)
> The solution for this is to replace “product of n and m” bij “least common multiple of n and m”

Nice, and it works for my example, too:

    Number of multiples of either 3 or 6
    = Number of multiples of 3
    + Number of multiples of 6
    - Number of multiples of lcm(3,6) = 6
    = Number of multiples of 3
Cool. How to extend to more than 2 numbers?
Re:Project Euler 001 the Hard Way by jarekkruk on Sunday February 02, 2020 @01:52PM (#22218577)
You could do it like in article, so for every nonempty element in powerset (combinations for each length) of those numbers calculate their lcm and add or subtract amount of multiplies of lcm according to length of element.

So for A, B, C you have (M-number of multipliers) M(lcm(A)) + M(lcm(B)) + M(lcm(C)) - M(lcm(B,C)) - M(lcm(A,C)) - M(lcm(A,B)) + M(lcm(A,B,C))