Numeric bases 10, 2, 8 and 16
A number can be thought of as a "polynomial" (meaning "many" "sums") in the
form:
N = an⋅Xn +
an-1⋅Xn-1 + ⋯ +
a1⋅X1 +
a0⋅X0
or:
where:
X is the base and:
an, an-1, ... ,a0
are constants modulo the base
Base 10 numbers:
X = 10
0 ≤ a
i ≤ 9
404 | = | 4⋅102 | + 0⋅101 | + 4⋅100 |
|
---|
| = | 400 | + 0 | + 4 |
|
| = | 404 | | | |
|
9261 | = | 9⋅103 | + 2⋅102 | + 6⋅101 | + 1⋅100
|
---|
| = | 9000 | + 200 | + 60 | + 1
|
| = | 9261 | | |
|
Powers of 10:
|
---|
100 | =1 | | 103 | =1000 | | 106 | =a million
|
101 | =10 | | 104 | =10000 | | 109 | =a billion
|
102 | =100 | | 105 | =100000 | | 1012 | =a trillion
|
Base 2 numbers (binary):
X = 2
0 ≤ a
i ≤ 1
100101 | = | 1⋅25 | + 0⋅24 | + 0⋅23 | + 1⋅22 | + 0⋅21 | + 1⋅20
|
---|
| = | 32 | + 0 | + 0 | + 4 | + 0 | + 1
|
| = | 37 | | | | |
|
Powers of 2:
|
---|
2=0 | =1 | | 24 | =16 | | 28 | =256 | | 212 | =4096
|
2=1 | =2 | | 25 | =32 | | 29 | =512 | | 213 | =8192
|
2=2 | =4 | | 26 | =64 | | 210 | =1024 | | 214 | =16384
|
2=3 | =8 | | 27 | =128 | | 211 | =2048 | | 215 | =32768
|
- Binary numbers are often prefixed with a
0b to indicate that is a binary number.
<< Convert some binary numbers to base 10.>>
Base 8 (Octal):
X = 8
0 ≤ a
i ≤ 7
Powers of 8:
|
---|
80 | =1 | | 83 | =512
|
81 | =8 | | 84 | =4096
|
82 | =64 | | 85 | =32768
|
- An octal number represents a 3 digit binary number.
- Usually prefixed with a leading
0 to indicate octal.
Base 16 (Hexadecimal):
X = 16
0 ≤ a
i ≤ 15
We use a-f/A-F to represent the numbers 10-15
FC65 | = | 15⋅163 | + 12⋅162 | + 6⋅161 | + 5⋅160
|
---|
| = | 61140 | + 3072 | + 96 | + 5
|
| = | 64613 | | |
|
Powers of 16:
|
---|
160 | =1 | | 163 | =4096
|
161 | =16 | | 164 | =65536
|
162 | =256 | | 165 | =1048576
|
- A hex number represents a 4 digit binary number.
- Often prefixed with a leading
0x to indicate hexadecimal.