## Introduction: K'Nex Binary Machine

This device can be used to add, subtract or multiply binary numbers (i.e. numbers expressed in base 2) by dropping balls into columns.

It can also be set to count sequentially so that you can see how base-2 counting works.

There is one column for each power of 2 (from 2

Starting with the machine showing 12 zeroes, if a ball is inserted into the column on the far right (Column 0), the displayed 0 is changed to 1.

When another ball is inserted in that column, the 1 is changed to 0 and the digit to the left (in Column 1) changes from 0 to 1, i.e. there has been a 'carry-over' (in base ten – i.e. decimal, our normal notation – a carry-over occurs when 9 is reached, but in binary it happens when 1 is reached). The machine now displays 000000000010, i.e. 10 in binary (we can ignore the leading zeroes, just like we can in base ten).

When a third ball is dropped into Column 0, it again changes to 1, and the machine now displays 11, representing 3 in base ten.

Now the fun starts. When a fourth ball is dropped into Column 0, there is a double carry-over, resulting in 100 being displayed (any leading zeroes will be ignored from now on), representing the number 4.

And so it goes on. After 4,096 balls have been inserted, the machine will show 12 zeroes once more, because the machine will have overflowed. The overflowing ball is held in a tray so that the machine can, in fact, register results of up to five digits by adding 4096

“So how can this machine be used to multiply numbers?” you may ask. Well, you must remember that, just as with our normal base-10 number system, the value of a digit is multiplied by 10 if it is shifted one position to the left, so a binary digit is worth twice as much if it is shifted one place to the left. For example, if you drop a ball in column 0, it is worth 1 (i.e. 2

Let’s multiply 23 by 17.

First of all, express these as the sum of different powers of 2: (16 + 4 + 2 + 1) x (16 + 1).

We are going to insert two balls, one in the Column 4 (because 2

We are now going to add 2 more 17s, but instead of adding two more lots of balls to Columns 4 and 0, we are going to speed things up by dropping one ball in Column 5 and one in Column 1, i.e. one column to the left of the first 17. This means that we have just added twice as much – 2 x (16 + 1), making (2 + 1) x (16 + 1) altogether. The balls in the machine now represent 110011, i.e. 51 in base 10. We know it’s 51 because all we have got to do is add up the values of the columns which have a 1 displayed (32 + 16 + 2 + 1).

We now need to add 4 17s and so we drop one ball in Column 6 and one in column 2, i.e. two columns to the left of the first balls, to make them worth four times as much. The machine now represents (4 + 2 + 1) x (16 + 1).

Finally, we need to add 16 17s by dropping the balls in the columns which are 4 to the left of the original two columns, i.e. Columns 8 and 5. It’s 4 columns to the left because 16 is 2

The machine ends up displaying 110000111 – there is a 1 in Columns 8, 7, 2, 1 and 0. The value of these bits is 2

So now we have the result: 23 x 17 = 391 – and all we had to do was drop eight balls into the machine and add five numbers together!

So what about subtraction? Yes – it can be done!

The rule is this: drop a ball into each of the 12 columns, EXCLUDING the columns whose total value is ONE LESS than the number which is to be subtracted. The displayed number will, after a certain amount of clickety-clacketing, represent the answer.

The video below shows the machine counting and also how it can be used to add, multiply and subtract binary numbers.

The machine used just over 10,000 pieces, but a version could be made which used far fewer: there could be fewer columns, the ball lift is not strictly necessary, the ball funnels do not have to be so elaborate, etc.

The PDF below describes various aspects of the machine.

It can also be set to count sequentially so that you can see how base-2 counting works.

There is one column for each power of 2 (from 2

^{0}= 1 to 2^{11}= 2048), thus enabling a 12-bit number to be handled.Starting with the machine showing 12 zeroes, if a ball is inserted into the column on the far right (Column 0), the displayed 0 is changed to 1.

When another ball is inserted in that column, the 1 is changed to 0 and the digit to the left (in Column 1) changes from 0 to 1, i.e. there has been a 'carry-over' (in base ten – i.e. decimal, our normal notation – a carry-over occurs when 9 is reached, but in binary it happens when 1 is reached). The machine now displays 000000000010, i.e. 10 in binary (we can ignore the leading zeroes, just like we can in base ten).

When a third ball is dropped into Column 0, it again changes to 1, and the machine now displays 11, representing 3 in base ten.

Now the fun starts. When a fourth ball is dropped into Column 0, there is a double carry-over, resulting in 100 being displayed (any leading zeroes will be ignored from now on), representing the number 4.

And so it goes on. After 4,096 balls have been inserted, the machine will show 12 zeroes once more, because the machine will have overflowed. The overflowing ball is held in a tray so that the machine can, in fact, register results of up to five digits by adding 4096

*n*to the displayed result where*n*is the number of balls in the overflow tray.“So how can this machine be used to multiply numbers?” you may ask. Well, you must remember that, just as with our normal base-10 number system, the value of a digit is multiplied by 10 if it is shifted one position to the left, so a binary digit is worth twice as much if it is shifted one place to the left. For example, if you drop a ball in column 0, it is worth 1 (i.e. 2

^{0}), but drop it in the column to the left - Column 1 - and it is worth 2 (i.e. 2^{1}). If you drop it in the column which is three places to the left, it is worth 2^{3}= 8 times as much.Let’s multiply 23 by 17.

First of all, express these as the sum of different powers of 2: (16 + 4 + 2 + 1) x (16 + 1).

We are going to insert two balls, one in the Column 4 (because 2

^{4}= 16) and the other in Column 0 (because 2^{0}= 1). We end up with the machine showing 10001. This is 17, i.e. one lot of (16 + 1).We are now going to add 2 more 17s, but instead of adding two more lots of balls to Columns 4 and 0, we are going to speed things up by dropping one ball in Column 5 and one in Column 1, i.e. one column to the left of the first 17. This means that we have just added twice as much – 2 x (16 + 1), making (2 + 1) x (16 + 1) altogether. The balls in the machine now represent 110011, i.e. 51 in base 10. We know it’s 51 because all we have got to do is add up the values of the columns which have a 1 displayed (32 + 16 + 2 + 1).

We now need to add 4 17s and so we drop one ball in Column 6 and one in column 2, i.e. two columns to the left of the first balls, to make them worth four times as much. The machine now represents (4 + 2 + 1) x (16 + 1).

Finally, we need to add 16 17s by dropping the balls in the columns which are 4 to the left of the original two columns, i.e. Columns 8 and 5. It’s 4 columns to the left because 16 is 2

^{4}. The machine is now showing (16 + 4 + 2 + 1) x (16 + 1).The machine ends up displaying 110000111 – there is a 1 in Columns 8, 7, 2, 1 and 0. The value of these bits is 2

^{8}+ 2^{7}+ 2^{2}+ 2^{1}+ 2^{0}= 391.So now we have the result: 23 x 17 = 391 – and all we had to do was drop eight balls into the machine and add five numbers together!

So what about subtraction? Yes – it can be done!

The rule is this: drop a ball into each of the 12 columns, EXCLUDING the columns whose total value is ONE LESS than the number which is to be subtracted. The displayed number will, after a certain amount of clickety-clacketing, represent the answer.

The video below shows the machine counting and also how it can be used to add, multiply and subtract binary numbers.

The machine used just over 10,000 pieces, but a version could be made which used far fewer: there could be fewer columns, the ball lift is not strictly necessary, the ball funnels do not have to be so elaborate, etc.

The PDF below describes various aspects of the machine.