K-12 Programming: Counting

education# Core counting

# The Counting Algorithm

How to find the next number
# How to Use the Algorithm in Class

Practical programming in kindergarten or first grade.

A few weeks ago I mentioned that the Computing in the Core coalition isn’t going far enough, that programming ought to be taught “from first grade on up, not as a glitzy ‘look what we can do with games’ but as a fundamental element of a well-educated person’s knowledge”. Today I want to offer one example, based on a notion taught in kindergarten and first grade: counting (in base 10). Base 10 is not my favorite. But it is so prevalent that it’s not practical to replace it. I may talk more on this in a future post.

To count, you need to memorize a sequence of digits: 1 → 2 → 3 → 4 → 5 → 6 → 7 → 8 → 9 → 0 → 1 → 2 → …. You need a name for moving along this sequence: we’ll call it incrementing a digit, which means going to the next digit in the sequence. And you need to remember “zero is special.” One way it’s special is that “a blank means zero.” That is all you need up front.

A number is a list of one or more digits. We always start with the right-most digit in a number and work our way to the left.

To find the next number after a number, increment its smallest digit. If that makes a 0, move to the next larger digit and increment it. If that makes a 0, move to the next larger digit and increment it. Keep going until you don’t make a 0.

start looking at the smallest digit;
repeat until you are done {
increment the digit;
if the new digit is a 0 {
look at the next digit
} otherwise {
you’re done!
}
}

Kids at this age can follow instructions. I’d present the bits and pieces in whatever syntax or display is going to be used throughout first two years in various activities and games. When counting past 20 or so was presented, I’d have them follow the instructions for counting, even incrementing numbers larger than they know how to say.

Loading user comment form…

Looking for comments…