News for hackers. Stuff that matters.
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))

There are no comments on this comment yet.