Problem 1201 · Medium

Ugly Number III

Binary search the answer: count multiples of a, b or c up to a value with inclusion-exclusion, which is monotone.

Open the interactive visualisation