Do you know how to add?

algorithm

We can all add, but can we describe how it works?

In class both yesterday and today I talked about addition. Yesterday was in computer architecture where we used it to explore how binary numbers work. Today was in introduction to programming where we used it to explore what variables and methods are in code. One of the surprising thoughts I’ve had from thinking about addition for several days is that I’m not sure most people can describe how it works.

Most adults I know can add any two single-digit numbers in their head without resorting to any kind of counting. They have memorized the addition tables. There is no process here; I say “3 + 8” and your brain instantly produces “11”.

But what about adding three one-digit numbers? Some people have shortcuts, but the basic process is as follows:

You add two of the numbers to get either a single digit

`x`or a 1 preceding a single digit`x`.You add

`x`to the third number two of the numbers to get either a single digit`y`or a 1 preceding a single digit`y`.If both of the additions gave a 1 you answer 2

`y`; if just one of them then 1`y`; if neither then just`y`.

We can all do this. We learned it when we were small children and have been doing it ever since. And yet, I find that most people, if asked to describe how to find the ten’s place of the sum of several 1-digit numbers in terms of summing pairs of digits honestly cannot articulate it.

ten's place of a + b + c + ...)

Let `ones` be the digit `a`;
Let `tens` be the digit 0;
For each other digit (`b`, `c`, `d`, …) {
Add the digit to `ones` (call the answer `sum`);
If the `sum` has two digits {
if `tens` = 9 {
let `tens` be 0
} otherwise {
increase `tens` by 1
}
};
Let `ones` by the one’s place of `sum`
};
The answer is the value of `tens`

As I tell my CS1 students, part of the challenge of programming is learning to think in terms so very simple that even a computer can understand them. That is a skill few people bother to develop unless it is so they can talk to computers.

Loading user comment form…

Looking for comments…