Count Divisibles in Range (simplified)
Given two integers, n and k, the task is to count how many numbers between 1 and n (inclusive) are divisible by k.
Input: Two integers (int).
Output: Integer (int).
Examples:
assert count_divisible(10, 2) == 5 assert count_divisible(10, 3) == 3 assert count_divisible(10, 5) == 2 assert count_divisible(15, 4) == 3
How it’s used: this function can be useful in number theory problems, statistical computations, and various other mathematical and practical scenarios where such a count is needed.
Precondition:
- 1 <= k <= n <= 109.