# Number Theory/Decadic numbers
## Prerequisites

All four operations for the integers (+,-,*,/)
Pencil and paper algorithms for addition, subtraction and multiplication
Rational numbers

## What is a decadic number?

You may have noticed that every number have a finite amount of digits. But what if that wasn't always the case? Then you get the decadic numbers. Examples include: ....11111, 5, ...2648323979853562951413 and ...999999999.

## Math of decadic numbers
### Addition

Addition of the decadic numbers is the same as that of the integers. You add each digit with the same place value together and add the carrying digits.

### Subtraction

In order to subtract decadic numbers, one must add the negative of the second number. But why, you may ask. In the integers, this holds. For example, 4-3=4+(-3). It is therefore a natural extension of subtraction in the integers.

#### How to find the negative

You may have noticed that ...99999+1=0, as illustrated here:
| (carry) | ... | 1 | 1 | 1 | 1 | 1 | |
| | ... | 9 | 9 | 9 | 9 | 9 | 9 |
| + | | | | | | | 1 |
| | ... | 0 | 0 | 0 | 0 | 0 | 0 |
...99999 behaves like -1, in the sense that -1+1=0. Now, -2=(-1)-1, -3=(-1)-2, -4=(-1)-3, etc. So -...10101010101010=(-1)-...10101010101009. Now that we have converted the negative in the form of (-1)-[something], we can calculate the negative. I'll use the example of ...2648323979853562951413.
| | ... | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 |
| - | ... | 2 | 6 | 4 | 8 | 3 | 2 | 3 | 9 | 7 | 9 | 8 | 5 | 3 | 5 | 6 | 2 | 9 | 5 | 1 | 4 | 1 | 2 |
| | ... | 7 | 3 | 5 | 1 | 6 | 7 | 6 | 0 | 2 | 0 | 1 | 4 | 6 | 4 | 3 | 7 | 0 | 4 | 8 | 5 | 8 | 7 |
Now, we can do say, ...101010101010101010101010101-...2648323979853562951413
| (carry) | | | | | | | | | | | | | | | | | | | | | | | |
| | ... | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 |
| + | ... | 7 | 3 | 5 | 1 | 6 | 7 | 6 | 0 | 2 | 0 | 1 | 4 | 6 | 4 | 3 | 7 | 0 | 4 | 8 | 5 | 8 | 7 |
| | ... | 7 | 4 | 5 | 1 | 6 | 8 | 6 | 1 | 2 | 1 | 1 | 5 | 6 | 5 | 3 | 8 | 0 | 5 | 8 | 6 | 8 | 8 |
In this case, there was no carry, but there might have been if we had done a different subtraction problem, hence why it's there.

### Multiplication

Multiplication works the same way in the decadic numbers as in the integers.

### Division

In order to divide, say 48/6, one must ask "What number times 6 is 48?" This also applies to the decadic numbers. Let's take a simple example, like 17/13:
| (quotient) | | |
| x | 1 | 3 |
| (dividend) | 1 | 7 |
| (addition carry) | | |
| (carry) | | |
| (3*quotient) | | |
| (carry) | | |
| (10*quotient) | | |
Well, what number times 3 ends in 7? Well, 9 obviously. So, we put 9 in the one's place at the top, then evaluate the multiplication thus far:
| (quotient) | | | 9 |
| x | | 1 | 3 |
| (dividend) | 0 | 1 | 7 |
| (addition carry) | | | |
| (carry for 3*quotient) | | 2 | |
| (3*quotient) | | | 7 |
| (carry for 10*quotient) | | | |
| (10*quotient) | | 9 | 0 |
As we've evaluated the one's place completely, we can now be sure that there's no addition carry into the tens place.
Now, we ask, what can we put in the shaded area, such that when we multiply the partial quotient by the divisor, the tens place gives one? Note that as 2+9=11 (i.e., ends in a 1), the square shaded must be 0 (i.e., 3*[tens place of quotient] must end in 0, implying that the tens place of the quotient must be 0). Once we've found the quotient's ten's place, we evaluate the multiplication again thus far:
| (quotient) | | | 0 | 9 |
| x | | | 1 | 3 |
| (dividend) | 0 | 0 | 1 | 7 |
| (addition carry) | | 1 | | |
| (carry for 3*quotient) | | | 2 | |
| (3*quotient) | | | 0 | 7 |
| (carry for 10*quotient) | | | | |
| (10*quotient) | | 0 | 9 | 0 |
As we've evaluated the tens place completely, we can now be sure that the carry into the hundreds place is 1.
Now, we ask, what can we put in the shaded area, such that when we multiply the partial quotient by the divisor, the hundreds place gives zero? Note that as 1+0=1 (i.e., ends in a 1), the square shaded must be a 9 (i.e., 3*[hundreds place of quotient] must end in 9- implying that the hundreds place of the quotient must be 3). Once we've found the quotient's hundred's place, we evaluate the multiplication again thus far:
| (quotient) | | | 3 | 0 | 9 |
| x | | | | 1 | 3 |
| (dividend) | 0 | 0 | 0 | 1 | 7 |
| (addition carry) | | 1 | 1 | | |
| (carry for 3*quotient) | | | | 2 | |
| (3*quotient) | | | 9 | 0 | 7 |
| (carry for 10*quotient) | | | | | |
| (10*quotient) | | 3 | 0 | 9 | 0 |
As we've evaluated the hundreds place completely, we can now be sure that the carry into the thousands place is 1.
Now, we ask, what can we put in the shaded area, such that when we multiply the partial quotient by the divisor, the thousands place gives zero? Note that as 1+3=4 (i.e., ends in a 4), the square shaded must be a 6 (i.e., 3*[thousands place of quotient] must end in 6- implying that the thousands place of the quotient must be 2). Once we've found the quotient's thousand's place, we evaluate the multiplication again thus far:
| (quotient) | | | 2 | 3 | 0 | 9 |
| x | | | | | 1 | 3 |
| (dividend) | 0 | 0 | 0 | 0 | 1 | 7 |
| (addition carry) | | 1 | 1 | 1 | | |
| (carry for 3*quotient) | | | | | 2 | |
| (3*quotient) | | | 6 | 9 | 0 | 7 |
| (carry for 10*quotient) | | | | | | |
| (10*quotient) | | 2 | 3 | 0 | 9 | 0 |
As we've evaluated the thousands place completely, we can now be sure that the carry into the tens of thousands (or myriads) place is 1.
Now, we ask, what can we put in the shaded area, such that when we multiply the partial quotient by the divisor, the tens of thousands place gives zero? Note that as 1+2=3 (i.e., ends in a 3), the square shaded must be a 7 (i.e., 3*[tens of thousands place of quotient] must end in 7- implying that the tens of thousands place of the quotient must be 9). Once we've found the quotient's tens of thousands' place, we evaluate the multiplication again thus far:
| (quotient) | | | 9 | 2 | 3 | 0 | 9 |
| x | | | | | | 1 | 3 |
| (dividend) | 0 | 0 | 0 | 0 | 0 | 1 | 7 |
| (addition carry) | | 1 | 1 | 1 | 1 | | |
| (carry for 3*quotient) | | 2 | | | | 2 | |
| (3*quotient) | | | 7 | 6 | 9 | 0 | 7 |
| (carry for 10*quotient) | | | | | | | |
| (10*quotient) | | 9 | 2 | 3 | 0 | 9 | |
As we've evaluated the tens of thousands place completely, we can now be sure that the carry into the hundreds of thousands (or lakhs) place is 1.
Now, we ask, what can we put in the shaded area, such that when we multiply the partial quotient by the divisor, the hundreds of thousands place gives zero? Note that as 1+2+9=12 (i.e., ends in a 2), the square shaded must be an 8 (i.e., 3*[tens of thousands place of quotient] must end in 8- implying that the hundreds of thousands place of the quotient must be 6). Once we've found the quotient's hundreds of thousands' place, we evaluate the multiplication again thus far:
| (quotient) | | | 6 | 9 | 2 | 3 | 0 | 9 |
| x | | | | | | | 1 | 3 |
| (dividend) | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 7 |
| (addition carry) | | 2 | 1 | 1 | 1 | 1 | | |
| (carry for 3*quotient) | | 1 | 2 | | | | 2 | |
| (3*quotient) | | | 8 | 7 | 6 | 9 | 0 | 7 |
| (carry for 10*quotient) | | | | | | | | |
| (10*quotient) | | 6 | 9 | 2 | 3 | 0 | 9 | |
As we've evaluated the hundreds of thousands place completely, we can now be sure that the carry into the millions place is 2.
Now, we ask, what can we put in the shaded area, such that when we multiply the partial quotient by the divisor, the millions place gives zero? Note that as 2+1+6=9 (i.e., ends in a 9), the square shaded must be a 1 (i.e., 3*[tens of thousands place of quotient] must end in 1- implying that the millions place of the quotient must be 7). Once we've found the quotient's millions' place, we evaluate the multiplication again thus far:
| (quotient) | | | 7 | 6 | 9 | 2 | 3 | 0 | 9 |
| x | | | | | | | | 1 | 3 |
| (dividend) | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 7 |
| (addition carry) | | 1 | 2 | 1 | 1 | 1 | 1 | | |
| (carry for 3*quotient) | | 2 | 1 | 2 | | | | 2 | |
| (3*quotient) | | | 1 | 8 | 7 | 6 | 9 | 0 | 7 |
| (carry for 10*quotient) | | | | | | | | | |
| (10*quotient) | | 7 | 6 | 9 | 2 | 3 | 0 | 9 | |
As we've evaluated the millions place completely, we can now be sure that the carry into the tens of millions (or crores) place is 2.
Now, we ask, what can we put in the shaded area, such that when we multiply the partial quotient by the divisor, the tens o millions place gives zero? Note that as 1+2+7=10 (i.e., ends in a 0), the square shaded must be a 0 (i.e., 3*[tens of thousands place of quotient] must end in 0- implying that the tens of millions place of the quotient must be 0). Once we've found the quotient's tens of millions' place, we evaluate the multiplication again thus far:
| (quotient) | | | 0 | 7 | 6 | 9 | 2 | 3 | 0 | 9 |
| x | | | | | | | | | 1 | 3 |
| (dividend) | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 7 |
| (addition carry) | | 1 | 1 | 2 | 1 | 1 | 1 | 1 | | |
| (carry for 3*quotient) | | | 2 | 1 | 2 | | | | 2 | |
| (3*quotient) | | | 0 | 1 | 8 | 7 | 6 | 9 | 0 | 7 |
| (carry for 10*quotient) | | | | | | | | | | |
| (10*quotient) | | 0 | 7 | 6 | 9 | 2 | 3 | 0 | 9 | |
But here, we end up asking the same question as with the hundreds place, meaning we arrive at the same state. And because the dividend 'looks the same' from here as from the hundreds place, there's no variation there either, and those digits will repeat forever. Thus, 17/13=${\overline {769230}}9$.

#### Why does it work?

An easy way to show why this works is to multiply the quotient by the divisor by hand, as so:
| | ... | 7 | 6 | 9 | 2 | 3 | 0 | 7 | 6 | 9 | 2 | 3 | 0 | 9 |
| x | | | | | | | | | | | | | 1 | 3 |
| | ... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 7 |
| (addition carry) | ... | 2 | 1 | 1 | 1 | 1 | 1 | 2 | 1 | 1 | 1 | 1 | | |
| (carry for 3*quotient) | ... | 1 | 2 | | | | 2 | 1 | 2 | | | | 2 | |
| (3*quotient) | ... | 1 | 8 | 7 | 6 | 9 | 0 | 1 | 8 | 7 | 6 | 9 | 0 | 7 |
| (carry for 10*quotient) | ... | | | | | | | | | | | | | |
| (10*quotient) | ... | 6 | 9 | 2 | 3 | 0 | 7 | 6 | 9 | 2 | 3 | 0 | 9 | |
This shows that we are essentially doing multiplication, but 'backwards'.

#### But what about 1/2, or 1/5?

Fine. I'll admit that I have cherry-picked my example. For 1/2, you get what times 2 is 1, an impossible question obviously. 1/2 is clearly equal to 5/10. Now, we can continue our place-value system, as it's called, by adding a tenths place, hundredths place etc. further to the right, like this:
| ... | hundreds | tens | ones | . | tenths | hundredths | ... |
| ... | 2 | 1 | 0 | . | 1 | 2 | |
We'll call the dot, a 'decimal point'. So, 1/2=0.5 and 1/5 is 0.2 Division by 2 just means multiplying by 1/2, and division by 5 means multiplying by 1/5. But how do you multiply by 0.5 or 0.2, one may ask. Well in the first case, multiplying by 0.5 means multiplying by 5 then moving the decimal point to the left. The reason is because 0.5 is 5/10, and to multiply by 5/10, you must multiply by five, then divide by ten. To divide by ten, one must move the decimal point to the left (e.g. 7.5/10 is .75), As per the logic above, multiplying by 0.2 involves multiplying by 2, then moving the decimal point to the left.

## Problems arising from 10 being 2*5
### A number you can't divide by (and no, it's not 0)

To square a number, you multiply it by itself (e.g. 5^2=5*5=25). Start with the number 5. Square it to give 25. Square 25 to give 625. Square 625 to give 390625. Square 0625 to give 3906265 etc, like in this table:
| Number | Number^2 |
| 5 | 25 |
| 25 | 625 |
| 625 | 390625 |
| 0625 | 390625 |
| 90625 | 8212890625 |
You will get ...18212890625. Now lets solve for 1/...18212890625. Now we have a pesky factor-of-5 problem. If you try to solve it normally, you run into the impossible question of "What number times 5 ends in 1?", an impossible question. So we divide both the top and bottom by 5, giving 0.2/...3642578125, which still has the same problem. So we try again, giving 0.04/...728515625, and again, 0.008/...145703125. The problem just doesn't seem to go away. It seems like you simply can't divide by this number. What's going on?
Well, notice how in each step, the numbers' squares ends in that number (e.g. 5^2=25, 25^2=625 etc.). It seems natural that the number we found must have a square equal to itself. Let's try that!
| (carry) | | | | | | |
| | ... | 9 | 0 | 6 | 2 | 5 |
| x | ... | 9 | 0 | 6 | 2 | 5 |
| | ... | 9 | 0 | 6 | 2 | 5 |
Ok. This may help us figure out what's going on.

#### Proof that this number can't be divided by

...18212890625*...18212890625=...18212890625 (this is true as we have proven this statement)
...18212890625*...18212890625/...18212890625=...18212890625/...18212890625 (assuming that number can be divided by and seeing if it implies nonsense: proof by contradiction)
...18212890625=1 (With the left hand side, multiplying by the number then dividing it again leaves the original number: 4*2=8, 8/2=4, 4*2/2=4. With the right hand side, any number, when divided by itself, must equal one: 4/4=1)
Now, $...18212890625\neq 1$ under our system as they look different, resulting in a contradiction.
An interesting thing to note is that ...18212890625*...18212890624=0 (this follows from the fact that ...18212890625 squares to itself)
This can be verified via multiplication:
| | ... | 1 | 8 | 2 | 1 | 2 | 8 | 9 | 0 | 6 | 2 | 5 |
| x | | 1 | 8 | 2 | 1 | 2 | 8 | 9 | 0 | 6 | 2 | 4 |
| | ... | | | | | | | 0 | 0 | 0 | 0 | 0 |
| | ... | | | | | | 2 | 1 | 1 | 1 | | |
| | ... | 3 | | | | 3 | 3 | | 2 | | 2 | |
| | ... | 4 | 2 | 8 | 4 | 8 | 2 | 6 | 0 | 4 | 8 | 0 |
| | ... | | | | 1 | 1 | | 1 | | 1 | | |
| | ... | 6 | 4 | 2 | 4 | 6 | 8 | 0 | 2 | 4 | 0 | |
| | ... | | 1 | 4 | 5 | | 3 | 1 | 3 | | | |
| | ... | 2 | 6 | 2 | 8 | 4 | 0 | 6 | 2 | 0 | | |
| | ... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | | |
| | ... | 7 | 8 | | 5 | 1 | 4 | | | | | |
| | ... | 8 | 2 | 1 | 0 | 4 | 8 | 5 | | | | |