0
$\begingroup$

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
$\endgroup$
1
$\begingroup$

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$

$\endgroup$
0
1
$\begingroup$

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.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.