As we saw earlier, designing a semi-adder in decimal is difficult because it has too many states. If you want to express the desired computation with simple on and off, switch to binary. Then again, have you ever wondered why we love the decimal system?

Why decimal?

Why did the decimal system so often coincide when it came to counting humans, who spread out of Africa some 70,000 years ago and formed civilizations? Yes, the answer lies in our hands, and it is no coincidence that our ten fingers are connected to our decimal system.

Imagine a bumper hunt for primitive humans. A leader excitedly counts the sheep he has captured, one, two… Wow, all fingers were used up and not finished counting, so I had to mark it on the ground first, and then pull back all fingers to continue counting.

The action of such a sign, then, was an early form of carry, and it is not surprising that we eventually developed a preference for the decimal system.

Other possibilities

It is said that there are tribes in Africa using the base 20 system. Some scholars went to investigate and found that they used their toes when counting. No wonder! In fact, people sometimes develop a genetic disorder called polydactyly, of which six fingers are the most common:

It’s malformed because they’re in the minority, and if they become mainstream, we might get used to using duodecimal!

Doraemon, the mouse-phobic cat, might prefer binary:

Is binary really the future? According to the author, its birthday is September 3, 2112. When you count it on your finger, alas, it’s not even 100 years old! The 22nd century was a long time ago when I was reading books

But when it comes to guessing with others, it’s a tragedy:

And if lobsters could one day build their own civilization, they might do it in quad:

Screenshots from the book Code.

Generalized base system

If we relax the standards a little, it is not hard to find that there are many bases in human society.

Take time, for example, which is a mixture of bases. Hours are 12 or 24 base, and minutes are 60 base. Except we’re still writing them in decimal notation. 23:59:59, plus one second is 00:00:00, because 60 or 24 is carried, and then zero.

If you notice that 12 is divisible by 2,3,4,6, and 60 is divisible by 2,3,4,5,6. So using this base is helpful to divide them more finely.

In terms of money, for example in Britain, it used to be that one pound was worth twenty shillings, and one shilling was worth twelve pence.

One shilling equals twelve pence, which of course makes it easy to divide.

In ancient China, we used hexadecimal system between weights.

Where do you think “six of one, six of the other” comes from?

Hexadecimal nature can make a catty many times to take half can also take the whole.

Summary of base

Below make small knots for various processes.

1. There are N different numbers (symbols) in the N base system.

So the decimal system has ten different numbers: 0,1,2,3,4,5,6,7,8,9;

So, binary has two different numbers, 0,1; (Borrowing the decimal notation)

What if it’s hexadecimal? So even borrowing all of the decimal notation wasn’t enough, so you either invented some new notation or borrowed some other notation.

For hexadecimal, six capital letters are actually borrowed, 0,1,2,3,4,5,6,7,8,9, A, B, C, D, E, F.

2. Enter 1 in every N base.

One into ten in decimal, one into two in binary.

For binary, 1+1 is going to carry, because it’s going to be 2, but binary doesn’t have a 2 sign, so it’s going to be 1 at most. The result is 10 (binary).

To get more values, add one repeatedly. The small red 1 indicates a carry:

The following is a corresponding table for decimal to binary and hexadecimal:

One bit can represent at most N different states. To represent more states, you need to use more bits. Two potential energies represent at most N×N states, three potential energies represent N×N×N states, and so on.

One hexadecimal can represent 16 states, and two digits can represent 16×16=256 states.

One decimal digit can represent 10 states, and two decimal digits can represent 10 x 10=100 states.

Similarly, one bit can represent two states, and two bits can represent 2×2=4 states.

Naturally, binary requires more bits than decimal to represent the same number of states. As shown above, at least four digits are required.

Nevertheless, any decimal integer can be represented in binary. In Cantor’s terms two infinite sets correspond one to one.

Conversion of base

What is the essence of a decimal number, say, 368?

3×102+6×101+8×100 =300+60+8 =368

For N base, N is the base of this exponent; The exponent is zero at the lowest point on the right, and then increases to the highest point on the left.

Binary to decimal

So for a binary number, such as 1010, the corresponding decimal number is:

1 * 22 23 + 0 + 1 * 20 = 8 + 21 + 0 0 + 2 + 0 = 10

So 10102 = 1010.

Subscripts are corresponding bases.

Decimal to binary

For the decimal to binary conversion, it is obtained by repeatedly dividing 2 exactly until the quotient is 0, and then taking the remainder. Take 12 for example:

So we have: 1210=11002

Advantages of binary

In the case of an addition table, for example, there are strictly 10×10=100 cases to consider if you are using decimal notation.

Think of the multiplication table of 99 that we memorized, which got rid of the zeros, and used the commutative law to get rid of some of the duplicates, and still had 45 entries, as an addition table.

What about binary? The number has been greatly reduced.

For n-base, there are N by N rules to consider. So, for binary, there are only four rules.

A binary addition table has only four rules:

00 0 + 0 =.

0 + 1 = 01,

1 + 0 = 01,

1 + 1 = 10.

The multiplication table is even simpler because there is no carry involved:

0 x 0 = 0,

0 x = 0, 1,

1 x 0 = 0,

1 x 1 = 1.

If you don’t multiply 0, there is only one entry: 1×1=1.

Compare the binary multiplication table with the decimal multiplication table:

Ah, if only binary had been used from the beginning, it would have been so intoxicating to think of that picture that even the dumbest kid could have mastered it in a minute!

Miss CAI 10, the spokesperson of binary, sings in a song: “That picture is too beautiful for me to watch…” (Prague Square, Jolin Tsai & Jay Chou)

We now feel that using binary is inconvenient and unaccustomed to it, probably because we have not accepted this way since childhood.

If you do it every day, you’ll probably get used to it.

There is a saying that there are 10 kinds of people in the world, those who understand binary and those who don’t.

The country needs someone like you who knows binary!

So much for the question of base. With that in mind, the next article will show you how to build the final binary half-adder.