# Subtraction of numbers with arbitrary bases [duplicate]

Possible Duplicate:
How to do +, -, *, / with number in a base b?

I am reading research papers in the category of recreational mathematics on the topic of numbers similar to Kaprekar number. Almost all the time we come across subtration of numbers with arbritrary bases such as 11, 13, 8 etc..

Can someone please explain me as to how this kind of calculation is to be done? Is there any free calculator/software available on net that does this kind of calculation?

-

## marked as duplicate by MJD, Ross Millikan, Gerry Myerson, Zev ChonolesJun 23 '12 at 20:04

– MJD Jun 22 '12 at 14:45

Let us subtract 313663 from 403155 in base 11. Digits in base 11 are 0,1,2,3,4,5,6,7,8,9,A. In base 11, instead of writing 10 + 1 = 11, we write A + 1 = 10. And instead of writing 10 + 10 = 20, we write A + A = 19. I will write base-11 numerals in this special font with the gray background, so that they are easy to recognize.

    4  0  3  1  5  5
-   3  1  3  6  6  3
--------------------


Let's call the columns, in order from right to left, columns $C_0, C_1,\ldots C_5$. The algorithm is the same as in base 10, except that we use 11 instead of 10. We start in column $C_0$. 5-3 is 2:

    4  0  3  1  5  5
-   3  1  3  6  6  3
--------------------
2


In column $C_1$, we have 5-6, which is negative, so we borrow an 11 from the 1 in column $C_2$ and change the 5 to a 15.

    4  0  3  0 15  5
-   3  1  3  6  6  3
--------------------
2


Note that the 15 in column $C_1$ is not the base-ten 15; it is the base-eleven 15, which is base-ten 16. 15-6 = A.

    4  0  3  0 15  5
-   3  1  3  6  6  3
--------------------
A  2


Now we can't take 6 from 0, so we borrow an 11 from the 3 in the $C_3$ column:

    4  0  2 10 15  5
-   3  1  3  6  6  3
--------------------
A  2


10-6 = 5:

    4  0  2 10 15  5
-   3  1  3  6  6  3
--------------------
5  A  2


Now in column $C_3$ we have 2-3, so we sould like to borrow from $C_4$, but $C_4$ has a 0, so there is nothing to borrow. So instead we borrow 11 from $C_5$ to $C_4$:

    3 10  2 10 15  5
-   3  1  3  6  6  3
--------------------
5  A  2


And then we can borrow from $C_4$ to $C_3$:

    3  A 12 10 15  5
-   3  1  3  6  6  3
--------------------
5  A  2


Now in column $C_3$ we have 12-3 = A, and in column $C_4$ we have A-1=9:

    3  A 12 10 15  5
-   3  1  3  6  6  3
--------------------
9  A  5  A  2


And finally in column $C_5$ we have 3-3 = 0, so we are done, and the answer is 403155 - 313663 = 9A5A2.

-
so it's basically the same thing? Nothing complicated as I was imagining? – user221287 Jun 22 '12 at 14:53
It's just the same. There is nothing special about 10. – MJD Jun 22 '12 at 14:54