Python Count Div
def count_div(a: int, b: int, k: int) -> int:
    first_div = a if a % k == 0 else a + (k - a % k)
    last_div = b - b % k

    return (last_div - first_div) // k + 1

This counts how many numbers in a range are divisible by K without looping through every value.