## 4.5.2.1 Number Base

Humans and computers are incompatible when they try to count. While Humans use Decimal and Unary systems of counting, computers can only interpret Binary. This is because computers can only process the presense or an absense of a signal, on or off, 1 or 0.

### Characters

When writing down numbers, humans (while using base 10) have a choice of ten characters. Computers only have a choice of two characters.

Below is a selection of different base systems and their characters.

Number System | Available Characters |
---|---|

Decimal (base 10) | 0 1 2 3 4 5 6 7 8 9 |

Unary (base 1) | 1 |

Binary (base 2) | 0 1 |

Octal (base 8) | 0 1 2 3 4 5 6 7 |

Hexadecimal (base 16) | 0 1 2 3 4 5 6 7 8 9 A B C D E F |

### Conversions

Dec | Bin | Oct | Hex | Unary |
---|---|---|---|---|

0 | 0 | 0 | 0 | |

1 | 1 | 1 | 1 | 1 |

2 | 10 | 2 | 2 | 11 |

3 | 11 | 3 | 3 | 111 |

4 | 100 | 4 | 4 | 1111 |

5 | 101 | 5 | 5 | 11111 |

6 | 110 | 6 | 6 | 111111 |

7 | 101 | 7 | 7 | 1111111 |

8 | 1000 | 10 | 8 | 11111111 |

9 | 1001 | 11 | 9 | 111111111 |

10 | 1010 | 12 | A | 1111111111 |

11 | 1011 | 13 | B | 11111111111 |

12 | 1100 | 14 | C | 111111111111 |

13 | 1101 | 15 | D | 1111111111111 |

14 | 1110 | 16 | E | 11111111111111 |

15 | 1111 | 17 | F | 111111111111111 |

16 | 10000 | 20 | 10 | 1111111111111111 |

To easily convert Decimal to Binary, attempt this methodology

Position | \(2^7\) | \(2^6\) | \(2^5\) | \(2^4\) | \(2^3\) | \(2^2\) | \(2^1\) | \(2^0\) |
---|---|---|---|---|---|---|---|---|

Decimal | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

12 | No | No | No | No | Yes | Yes | No | No |

Convert simply by subtracting powers of two until they fit.

Converting binary to hexadecimal is equally as easy. Split the binary into groups of four and convert each 4 bits into a hex digit.