Determine the divisor so that the quotient is less than 6,000.

29 Views Asked by At

Determine the divisor so that the quotient is always less than 6,000. The dividend may be any number less than, greater than or equal to 6,000.

I'm looking for a formula to help speed up a process at work. I can code this out in long hand using if/then statements (sample below), but I'm wondering if there are any creative math folk that could simplify this. I don't need it coded, I can do that myself if someone provides me a better logic than what I have.

Let's I have these dividends: 5000,13000,28000 (100000 max). I want their quotient to be less than 6000. In other words, I want to know the divisor

if 6000 >= x > 6000, result=1
elif 12000 >= x > 6000, result=2
elif 18000 >= x > 6000, result=3
elif 24000 >= x > 6000, result=4
elif 30000 >= x > 6000, result=5
2

There are 2 best solutions below

0
On

It sounds like you want the smallest divisor that is acceptable. Given $n$ the result is $\lfloor\frac n{6000}\rfloor$. If you want the quotient strictly below $6000$ you need to subtract $1$ if $n$ is an exact multiple of $6000$

0
On

What you want is called integer division. How you code it depends on what language you are using. For example, in python 3 you would write x//6000. In the C-type languages you would write x/6000, assuming x is an integer variable.