記數系統決定如何使用一組符號來表示數(number)。
positional numeral system e.g. decimal(十進位), binary (二進位), octal (八進位), hexadecimal(十六進位)
non-positional numeral system e.g. Roman numerals (羅馬數字)
$\space\textrm {I}$ | $\space\textrm{V}$ | $\space\textrm{X}$ | $\space\textrm{L}$ | $\space\textrm{C}$ | $\space\space\textrm{D}$ | $\space\space\textrm{M}$ |
---|---|---|---|---|---|---|
1 | 5 | 10 | 50 | 100 | 500 | 1000 |
十進位(decimal, base-10)
有10個數字:0 - 9
$5348_{10}=5\times10^3+3\times10^2+4\times10^1+8\times10^0$
二進位(binary, base-2)
有2個數字:0和1
$10011_2=1\times2^4+0\times2^3+0\times2^2+1\times2^1+1\times2^0(=19_{10})$
十六進位(hexadecimal, base-16)
有16個數字:0 - 9 and A - F (A、B、C、D、E、F分別代表10、11、12、13、14、15)
$1\text{C}6\text{F}{16}=1\times16^3+\text{C}\times16^2+6\times16^1+\text{F}\times16^0(=7279{10})$
$b$ 進位
一般來說,$b$ 進位有$b$個數字,且一個數 $(a_3 a_2 a_1 a_0)_b$ 可表示為:
$(a_3 a_2 a_1 a_0)_b=a_3\times b^3+a_2\times b^2+a_1\times b^1+a_0\times b^0$
($a_3 a_2 a_1 a_0$是一個數字序列,不是數字相乘)
$$ \def\arraystretch{1.2} \begin{array}{|c:c:c:c|} \hline \color{darksalmon}\textsf{Decimal} & \color{darksalmon}\space\textsf{Binary}\space & \color{darksalmon}\space\space\textsf{Octal}\space\space & \color{darksalmon}\textsf{Hexadecimal} \\ \hline 0 & 0000 & 0 & 0\\ \hdashline 1 & 0001 & 1 & 1\\ \hdashline 2 & 0010 & 2 & 2\\ \hdashline 3 & 0011 & 3 & 3\\ \hdashline 4 & 0100 & 4 & 4\\ \hdashline 5 & 0101 & 5 & 5\\ \hdashline 6 & 0110 & 6 & 6\\ \hdashline 7 & 0111 & 7 & 7\\ \hdashline 8 & 1000 & 10 & 8\\ \hdashline 9 & 1001 & 11 & 9\\ \hdashline 10 & 1010 & 12 & \textsf{A}\\ \hdashline 11 & 1011 & 13 & \textsf{B}\\ \hdashline 12 & 1100 & 14 & \textsf{C}\\ \hdashline 13 & 1101 & 15 & \textsf{D}\\ \hdashline 14 & 1110 & 16 & \textsf{E}\\ \hdashline 15 & 1111 & 17 & \textsf{F}\\ \hline \end{array} $$