Calculate mode of 2 numbers with the same base !!!!

226 Views Asked by At

I have 2 numbers with same base(not necessary 10).

I want to calculate the mode(Remainder of the division) of this 2 numbers without changing the base of them.The base of this 2 number can be between 2 to 10.For base 10 the answer is easy but what about the other bases

Is there any way that I calculate the mode of this 2 numbers

For example:
number 1: 1100
number 2: 101
both in base 2
The answer is :10 in base 2

2

There are 2 best solutions below

2
On BEST ANSWER

You can perform the division algorithm in any base. But you can just convert to any known basis and convert back the remainder: $$ 1100_2=12,\quad 101_2=5,\quad 12\bmod 5=2=10_2 $$

Actually, division in base $2$ is really easy, because it doesn't involve guessing: at each step the quotient is either $0$ or $1$. $$ \begin{array}{cccc|ccc} 1&1&0&0 & 1&0&1 \\ \\ 1&0&1& & 1&0\\ & &1&0 \end{array} $$ (unfortunately MathJax doesn't seem to support \cline). In the first step we consider three digits, the quotient is $1$; the subtraction gives $1$ and we consider the next digit. The number $10_2$ is less than $101_2$, so the quotient is $0$ and we're done.

0
On

You can perform long division of one number (the dividend) by another (the divisor) in any base $n$, where both the dividend and the divisor are in base $n$. The result, as in base 10, yields the quotient (at the top) and the remainder $r$ (at the bottom most row, $0 \leq r \lt $ the divisor).

See, for example, Wikipedia's entry on long division: the subsection on non-base 10 division.