## Monday, August 13, 2012

### Counting in different bases.

This is going to be a pretty short post, to introduce a concept that will be needed in future.
That concept is binary.

The first thing to think about is that when we count, using Arabic numerals we have ten symbols.
So we could in base ten, (Decimal)

Counting works in a really simple way, we start with our lowest value symbol, and cycle through our symbols until we get to the end of the set, then we start again at the beginning putting the first symbol in our set in front of the least significant number.

most significant, digit digit digit. least significant.

to a number 10,001

The most significant part is the ten thousand, the least significant part is one.

so counting, our numerals are
0,1,2,3,4,5,6,7,8,9

when we hit nine we put our second lowest value numeral to the left in the most significant space and then cycle through numerals again.
we use the second lowest, because our lowest is 0.
000012 is the same as 12

10,11,12,13,14,15,16,17,18,19 ... 101,102,103 .... etc and so on.

Base 2
in base 2 we only use two numerals, 0 and 1

then we've exhausted out numerals and have to put our second lowest value to the left, and cycle through, we do this again and again again again:

0, 1, 10,  11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111 and so on.

Base 8
In base 8 we have 8 symbols
0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16 ,17, 20, 21, 22, 23, 24, 25, 26, 27, 30

Base 16
In base 16 we use 16 symbols, these are
0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f

so we count in the following way.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1a, 1b, 1c, 1d, 1e, 1f, 20, 21 and so on...

Counting from 0 to 63 the various numbers look the following way.

0              000000                    00                      00
1              000001                     01                     01
2              000010                     02                     02
3              000011                     03                     03
4              000100                     04                     04
5              000101                     05                     05
6              000110                     06                     06
7              000111                     07                     07
8              001000                     10                     08
9              001001                     11                     09
10             001010                     12                     0a
11             001011                     13                     0b
12             001100                     14                     0c
13             001101                     15                     0d
14             001110                     16                     0e
15             001111                     17                     0f
16             010000                     20                     10
17             010001                     21                     11
18             010010                     22                     12
19             010011                     23                     13
20             010100                     24                     14
21             010101                     25                     15
22             010110                     26                     16
23             010111                     27                     17
24             011000                     30                     18
25             011001                     31                     19
26             011010                     32                     1a
27             011011                     33                     1b
28             011100                     34                     1c
29             011101                     35                     1d
30             011110                     36                     1e
31             011111                     37                     1f
32             100000                     40                     20
33             100001                     41                     21
34             100010                     42                     22
35             100011                     43                     23
36             100100                     44                     24
37             100101                     45                     25
38             100110                     46                     26
39             100111                     47                     27
40             101000                     50                     28
41             101001                     51                     29
42             101010                     52                     2a
43             101011                     53                     2b
44             101100                     54                     2c
45             101101                     55                     2d
46             101110                     56                     2e
47             101111                     57                     2f
48             110000                     60                     30
49             110001                     61                     31
50             110010                     62                     32
51             110011                     63                     33
52             110100                     64                     34
53             110101                     65                     35
54             110110                     66                     36
55             110111                     67                      37
56             111000                     70                     38
57             111001                     71                     39
58             111010                     72                     3a
59             111011                     73                     3b
60             111100                     74                     3c
61             111101                     75                     3d
62             111110                     76                     3e
63             111111                     77                     3f