Skip to content

Counting the Human Way: Decimal

I assume that even before I introduce the decimal system, you already know it. I believe that just by making it this far, you're already starting to understand how important it is. The unary system really does solve a problem, but it's not the only way to solve it. Not only is it not the only way, it's one of the worst. The bigger the number you want to represent, the worse the solution becomes to use.

Why am I learning this?

It's important for you to start developing this understanding, because this concept - that a solution existing doesn't necessarily mean it's the only solution, or even a good one - will follow you for the rest of your journey in computing, and it will be important to think about it while you program, so you can write better code.

Writing a program that does what you want doesn't necessarily mean it's a good program. We'll learn more about this in the next chapter - Chapter 2 - Algorithms and Logic.

At the end of the last section, we arrived at an intuition: what if we used different symbols for different quantities? The decimal system is exactly that. Instead of a single repeated symbol, it uses ten different symbols - the digits you already know: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Each one represents a different quantity, from nothing (the absence of value, the 0) up to nine.

But then an obvious question comes up: what about ten? We've reached the end of the available symbols and the numbers haven't ended. How do we represent more than nine "somethings"?

The Genius of the Decimal System

The decimal system has one insight that makes it truly powerful: it's not just that there are several symbols, it's that the position of each symbol also changes its value. The 9 in "92" doesn't mean nine, it means ninety. The same symbol on its own represents only nine units; on the left, in "92", it means ninety units.

Going deeper

The 9 in "9" means nine units of something. When all the symbols run out, we start over from the beginning - but with one difference: we place the symbol 1 on the left to indicate that we already have one complete group of ten units, better known as a "ten". To its right, we place however many loose units exist beyond that ten.

In practice: after reaching 9, the next number is 10 - one group of ten, plus zero loose units.

  • Continuing: 11 is one group of ten plus one unit,
  • 12 is one group of ten plus two units,
  • and so on, up to 19.
  • When the units run out again, we gain one more ten: 20 (two groups of ten, plus zero units).

This logic repeats indefinitely: ..., 98, 99, and then 100, which means one group of a hundred, zero tens, and zero loose units. Then 101, 102, 103...

Without that, to write something like "twenty-five units" in the most efficient way, we might have to write something like "997" (stacking the highest digits until we reach the value we want: 9 + 9 + 7 = 25). It would still work and would still be far more scalable than the unary system, but with the insight of different positions representing different values, the system becomes highly efficient. Now, the general who wanted to write 900 soldiers no longer needs to use nine hundred marks; he can use just three symbols: 9, 0, and 0.

Why Ten Symbols?

Now that you understand how the system works, it's worth asking: why ten symbols? Why not five, or twelve, or twenty?

If having different symbols for different quantities is smart, why not have more symbols for bigger numbers? Why only the digits 0 through 9 and not also a symbol for the number 10, for example? Or for the number 17, 500, 1000? That way we could represent 1000 units with a single symbol, not 4.

Ten isn't a magic number. Look at your hands.

Ten fingers. It's not a coincidence. For thousands of years, before paper, before pens, before any tool at all, fingers were the most accessible calculator there was. You didn't need to carry anything; they were always right there. When someone needed to count something and show the result to another person, they raised their fingers. It's natural, intuitive, and universal.

Many peoples built their counting systems naturally around fingers without even realizing they were making a choice. To them, ten was simply the number of fingers they had. There was nothing to question.

But it was just that: a choice. Other civilizations arrived at different numbers for the same reason: each counted with whatever felt most natural to them. The Maya used twenty symbols, because they included their toes in the count. For mathematical convenience, the Babylonians chose to use sixty, a number that still survives today: it's why an hour has 60 minutes and a minute has 60 seconds.

Fun fact

The Babylonians chose sixty out of pure mathematical convenience: 60 is divisible by 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, and 30. No small number has that many divisors. For a civilization that needed to divide land, calculate taxes, split up goods, and measure time, having a highly divisible base number was extremely practical. You rarely ended up with awkward fractions in everyday math.

So the Babylonian logic wasn't "we count on our fingers", it was "we chose the most convenient number to calculate with." It's a completely different motivation from the Maya's, and probably from the origin of decimal.

Important note

Here, I tried to explain the origin of the decimal system based on the most widely accepted hypothesis we have today, but this historical origin is just that - a hypothesis we hold nowadays, not a 100% proven fact.

The simple explanation is that counting on your fingers is a unary system; you still need to raise one finger for each quantity. Ten raised fingers isn't the symbol "10", it's ten physical marks. So the explanation that decimal came from fingers doesn't explain decimal itself, but rather the title of this subsection, "Why ten symbols." It only explains why we chose to have ten symbols. Those are two different things.

Someone, at some point, counted on their fingers, got to ten, and when they needed to record that on paper, decided to create a different symbol for each quantity their fingers could show: one symbol for one raised finger, another for two fingers, another for three, and so on up to nine. And for the moment when all fingers were down, the zero.

That's a good explanation, which is why it's socially accepted, but it's still strange, because there could perfectly well have been a symbol for all ten fingers raised, too.

The continuation of the hypothesis is that the invention of the positional system (using position to multiply value) is a separate, later step. Someone realized that instead of creating a new symbol for ten, they could reuse the symbols that already existed by combining them intelligently. That's why a simple list of ten symbols becomes a system that can represent any number.

The Problem with Decimal in Computing

The decimal system works very well for humans. But computers don't have ten fingers. They're made of lots of sets of tiny electrical circuits. And an electrical circuit, in its simplest form, only knows how to do one thing: let power through, or not. On or off. There's no "sort of on"; either there's current or there isn't. It's as if, instead of having ten fingers, it had only one: either the finger is up, or it's down.

For a computer, physically representing ten distinct states would be extremely complex and error-prone. Representing two states, on the other hand, is simple, reliable, and cheap to implement. Either power is flowing, or it isn't.

So the same question comes up that came up when the unary system started showing its limitations: is there a better system for this computer context? A system that, just like decimal, uses symbols and positions to represent numbers - because we've already seen that not just symbols, but using positions too, makes the system more powerful - but that works with only two symbols instead of ten?

There is, and it's what we'll study next.

Before moving on

Can you explain what a positional system is and why it's more efficient in numbering systems than just using symbols without giving any meaning to positions?

And why the decimal system, despite working well for humans, poses a problem for computers?

If you can answer those questions, you're ready to understand binary systems.