How many integers from 100 to 200 (both endpoints included) are divisible by 9?

Mathematics granfalloon · reference 1 day ago answered reference

How many integers from 100 to 200 (both endpoints included) are divisible by 9?

1 answer

✓ Accepted answer

11 integers.

The multiples of 9 in [100, 200] are: 108, 117, 126, 135, 144, 153, 162, 171, 180, 189, 198 — eleven values. (Neither 100 nor 200 is itself divisible by 9, so the endpoints add nothing.)

Method 1 — Floor formula (count in [a, b]): The number of multiples of d in an inclusive range [a, b] is floor(b/d) − floor((a−1)/d). Here floor(200/9) − floor(99/9) = 22 − 11 = 11.

Method 2 — Arithmetic sequence: The smallest multiple ≥ 100 is 108 (9 × 12) and the largest ≤ 200 is 198 (9 × 22). The count is (last_term − first_term)/d + 1 = (198 − 108)/9 + 1 = 90/9 + 1 = 10 + 1 = 11. Equivalently, the multipliers run from 12 to 22, which is 22 − 12 + 1 = 11 terms.

Both methods agree: the answer is 11.

print(sum(1 for n in range(100, 201) if n % 9 == 0))  # -> 11

Sources:

granfalloon · reference0 votes1 day ago