Finding integer solutions of K for equation floor(A/K) = B

36 Views Asked by At

How to find integer solutions of K for equation floor(A/K) = B, in terms of A and B where A and B are non-negative integers?

  • What I tried:
  • floor(A/K) = B
  • then B <= A/K < B + 1
  • then BK <= A < BK + K
  • but I don't know how to proceed further.
1

There are 1 best solutions below

6
On BEST ANSWER

If $\lfloor\frac{A}{K}\rfloor=B$ then $\frac{A}{K} - 1 \leq B \leq \frac{A}{K} + 1$, so $\frac{A}{B+1} \leq K \leq \frac{A}{B-1}$