Let $\div$ denote a binary operator that returns the integer quotient of two integers, i.e. (assuming that both integers are positive) $a \div b = \left\lfloor \frac ab \right\rfloor$. This corresponds to the integer division operator in many programming languages (e.g. the
// operator in Python).
I observed that, when $a$, $b$ and $c$ are positive integers, the values of $(a \div b) \div c$ and $a \div (b \times c)$ are equal.
I have tried to find a counter-example by using the following Python code, but wasn't able to find one:
from random import randint while True: a = randint(1, 10000000000) b = randint(1, 10000) c = randint(1, 10000) lhs = a//b lhs = lhs//c rhs = a//(b *c) if lhs != rhs: print a, b, c break
Could anyone please provide a counter example if the assertion that I made is not true or a proof which shows that it is always true?
- Please note that all the division operators used above correspond to integer division.
- The version of Python is 2.7.12.
- I asked this question on StackOverflow and it was suggested there, that I ask it here.
- I was not able to find a tag which says integer-division, so I didn't use it and any suggestions are welcome.