Recently Lego released an excellent new minifigure of a programmer. My two daughters (7 & 9 year olds) love the minifigure and wondered what the 1s and 0s that are on her top meant.
The numbers on her top are:
They thought it was computer related as they know computers work in 1s and 0s, but they wanted to know what the number represented. So we began the following investigation. In this post they learnt how computers count, then we go on in subsequent posts to discover what these numbers mean, and what they could be used for.
Before we learn how computers count let’s revisit how we count. With ten fingers it was natural for us to count in tens. If we had only eight fingers we would no doubt have learnt to count in eights. Computers are built from switches. These switches can either be off or on, and therefore computers only know about 0 and 1. 1 is used for on, 0 is used for off. This is like a computer only having one finger to count on.
So how do they count bigger numbers using only one finger. In the same way we do with 10 fingers.
We count with 10 fingers by:
- As we count from 0 to 9 we are counting in ones.
- When we get to 10 we have 1 ten and 0 ones.
- With 11 we have 1 ten and 1 ones.
- With 12 we have 1 ten and 2 ones.
- and so on.
We can think of this in different columns, starting from the right we go from 1s, 10s, 100s, 1000s etc. We start in the right columns (1s) and count up. When we get to 10, we clear this column and add one to the next column. The same applies for all columns, when they reach 10, we clear the columns and add one to the next column.
You can try this out below by clicking the ‘+’ button to add one. As the columns gets to 10 it will clear the columns.
Counting in 10 is called base 10 or decimal. Now lets imagine we had eight fingers and we counted in eights. This is called base 8 or Octal. The same rules apply, but with two small changes:
- When we reach eight we clear the columns and add one to the next column.
- The columns are no longer represent 1s, 10s, 100s, 1000s. Instead they go up as 1s, 8s, 64s, 512 etc.
At the top we can see the decimal number, and at the bottom of the columns we can see the Octal equivalent. Try counting up to 21 in decimal. You should see the Octal equivalent is 25.
Now’s it’s time to count with just 0s and 1s. This is known as base 2 or Binary and it’s what computer use to count, store information and follow instructions. Again the same rules apply but we just need to change a couple of them:
- When we reach two we clear the columns and add one to the next column.
- The columns are no longer represent 1s, 10s, 100s, 1000s. Instead they go up as 1s, 2s, 4s, 8s, 16s, 32s, 64, 128s etc. I’ve added more columns this time as otherwise we’ll quickly run out.
Try counting to 21 in decimal again. This time you will see the binary equivalent is 10101.
With eight columns we can count from 0 to 255. Why 255? This is 0 + 1 + 2 + 4 + 8 + 16 + 32 + 64 + 128.
This is also called 8 bits, and is also known as 1 byte (there are 8 bits in a byte).