Divisible by Both
Challenge on lesson: Checkpoint — Number Theory
CHALLENGE
Difficulty: intermediate+25 XP
**Description:** Count the integers in [1, n] divisible by **a or b**
(inclusive or). Use inclusion-exclusion with lcm — do not loop to n.
**Input:** One line: n a b (1 <= n <= 10^18, 1 <= a, b <= 10^9).
**Output:** One integer — the count.
**Example:** 10 2 3 -> 7 (2, 3, 4, 6, 8, 9, 10).
Press Submit to check your solution.
Back to lesson: Checkpoint — Number Theory