# 基数

在位值记数制中，**基数**（radix，或称底数）是该系统所使用的不同数位符号的固定数目，也是把每一个数位与下一个数位联系起来的恒定乘数。在一个基数为
(r) 的位值记数制中，若
(r) 是大于 1 的自然数，则使用与从零开始的前
(r) 个自然数相对应的
(r) 个基本符号，而每一个数位的值，等于该数位上的数字乘以由其所处位置决定的基数的幂<sup>[1](https://mathresearch.utsa.edu/wiki/index.php?title=Number_Systems,_Base_10,_5_and_2)</sup><sup> • </sup><sup>[2](https://courses.cs.vt.edu/~cs2505/fall2010/Notes/pdf/T01.NumericBases.pdf)</sup>。日常使用的十进制基数为 10；二进制基数为 2，八进制为 8，十六进制为 16。

| 关键事实 | 细节 |
|---|---|
| 定义 | 基数是位值制中不同数字的数目；每一个数位的权重为
(r^i)<sup>[3](https://uou.ac.in/sites/default/files/slm/MCS-404.pdf)</sup> |
| 表示定理 | 任何正整数
(n) 都有唯一的基数
(r) 表示
(n = a_k r^k + \cdots + a_1 r + a_0)，其中数字
(a_j \in \{0, \ldots, r-1\})，且
(a_k \neq 0)<sup>[4](https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructures/Chapter4/integer-representations.html)</sup> |
| 历史上的基数 | 巴比伦六十进制（公元前第二千纪），玛雅二十进制，印度十进位值制<sup>[5](https://library.ethz.ch/en/collections-and-archives/platforms/virtual-exhibitions/fibonacci-un-ponte-sul-mediterraneo/fibonaccis-significance-for-the-present-day/dDevelopment-of-numeral-systems.html)</sup><sup> • </sup><sup>[6](https://mathshistory.st-andrews.ac.uk//HistTopics/Indian_numerals/)</sup> |
| 计算中的基数 | 二进制、八进制和十六进制是现代技术时代重要的记数制<sup>[4](https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructures/Chapter4/integer-representations.html)</sup> |
| 基数排序 | 以基数
(r) 按位排序，对
(n) 个不同的键需要
(k \geq \log_r n) 趟，因此一般情形下最好的复杂度也是
(\Omega(n \log n))<sup>[7](https://opendsa-server.cs.vt.edu/ODSA/Books/wfu/csc201-b/fall-2026/201B/html/RadixSort.html)</sup> |
| 标准 | IEEE 854-1987 的标题为《与基数无关的浮点算术标准》<sup>[8](https://standards.ieee.org/ieee/754/6210/)</sup> |

## 位值记数法

位值记数法是这样一种记数制：其中每一个位都通过一个恒定的乘数与下一位相关联，这个乘数就是底数或基数<sup>[2](https://courses.cs.vt.edu/~cs2505/fall2010/Notes/pdf/T01.NumericBases.pdf)</sup>。在一般的位值记数制中，基数可以是任意整数
(r \geq 2)，而第
(i) 个数位的权重为
(r^i)<sup>[3](https://uou.ac.in/sites/default/files/slm/MCS-404.pdf)</sup>。例如在十进制中：

\[ 12345 = 1 \cdot 10^4 + 2 \cdot 10^3 + 3 \cdot 10^2 + 4 \cdot 10^1 + 5 \cdot 10^0 \]

同样的展开在任何基数下都成立。一个用位值记数法表示的数，其值等于各个数位之值的总和<sup>[2](https://courses.cs.vt.edu/~cs2505/fall2010/Notes/pdf/T01.NumericBases.pdf)</sup>。位值制还要求有一个表示空位的符号：零。没有它，像 101、110 和 11 这样的数就无法区分<sup>[9](https://openstax.org/books/contemporary-mathematics/pages/4-2-early-numeration-systems)</sup>。

位值制可以选用任意基数来构造<sup>[4](https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructures/Chapter4/integer-representations.html)</sup>。现代通用 10 作为基数，通常归因于人类有十根手指；历史上不同的群体使用过不同的基数，玛雅人用二十进制，巴比伦人用六十进制，这就是时间和角度至今仍以 60 秒、60 分为一组来度量的原因<sup>[4](https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructures/Chapter4/integer-representations.html)</sup>。

## 历史上的基数

**巴比伦六十进制。** 巴比伦人在公元前第二千纪之初就已熟悉位值制，它建立在古老的苏美尔六十进制系统之上。他们只用两种楔形文字符号来书写一切数字，这些符号视位置不同而表示一、十或六十；这种记法支撑了高度发达的代数学和复杂的计算<sup>[5](https://library.ethz.ch/en/collections-and-archives/platforms/virtual-exhibitions/fibonacci-un-ponte-sul-mediterraneo/fibonaccis-significance-for-the-present-day/dDevelopment-of-numeral-systems.html)</sup>。他们的系统缺少表示 0 的符号，因此当某一 60 的幂缺失时，就留一个空格作为占位符<sup>[9](https://openstax.org/books/contemporary-mathematics/pages/4-2-early-numeration-systems)</sup>。

**玛雅二十进制。** 玛雅人采用了一种基于 20 的幂的位值制，并有专门表示零的符号；到 665 年，他们已经使用二十进制的位值记数系统<sup>[9](https://openstax.org/books/contemporary-mathematics/pages/4-2-early-numeration-systems)</sup><sup> • </sup><sup>[6](https://mathshistory.st-andrews.ac.uk//HistTopics/Indian_numerals/)</sup>。

**印度十进制。** 印度人最早发展出十进位值制<sup>[6](https://mathshistory.st-andrews.ac.uk//HistTopics/Indian_numerals/)</sup>。到公元六世纪中叶，印度已经产生了一种用现代数字 1 至 9 的前身来表示数字的方法；大约在同一时期，零开始出现在文字记录中，最初是一个点，后来才采取圆圈的形态<sup>[5](https://library.ethz.ch/en/collections-and-archives/platforms/virtual-exhibitions/fibonacci-un-ponte-sul-mediterraneo/fibonaccis-significance-for-the-present-day/dDevelopment-of-numeral-systems.html)</sup>。现存有明确纪年的最古老的、含有以今日所用位值形式书写的数字的印度文献，是一份采用切迪历（Chhedi）纪年为 346 年的捐赠文书，换算过来即公元 594 年，不过有些历史学家声称这个日期是后来添上的<sup>[6](https://mathshistory.st-andrews.ac.uk//HistTopics/Indian_numerals/)</sup>。到公元 650 年前后，作为数而非仅仅作为占位符的零已经进入印度数学；关于印度使用零的最早、有明确纪年且被普遍接受的可靠记录，是 876 年瓜廖尔（Gwalior）的一处石刻<sup>[10](https://mathshistory.st-andrews.ac.uk/HistTopics/Zero/)</sup>。

**向西传播。** 印度数字是经由阿拉伯世界而非直接传入欧洲的<sup>[11](https://mathshistory.st-andrews.ac.uk/HistTopics/Arabic_numerals/)</sup>。八世纪时，阿拉伯人通过贸易路线采纳了印度记数法及其计算方法<sup>[5](https://library.ethz.ch/en/collections-and-archives/platforms/virtual-exhibitions/fibonacci-un-ponte-sul-mediterraneo/fibonaccis-significance-for-the-present-day/dDevelopment-of-numeral-systems.html)</sup>。花拉子米（Al-Khwarizmi）写了一部著作，描述以 1 至 9 和 0 为基础的印度位值记数制，这是今伊拉克地区最早把零用作位值记数中的占位符的文献<sup>[10](https://mathshistory.st-andrews.ac.uk/HistTopics/Zero/)</sup>。斐波那契（Fibonacci）的《计算之书》（*Liber abaci*）在欧洲首次系统地介绍了这种新的计算方法，但它在日常实践中的采用却颇为勉强；阿拉伯数字被认为易于伪造而不安全，因为一个零很容易被改成 6 或 9<sup>[5](https://library.ethz.ch/en/collections-and-archives/platforms/virtual-exhibitions/fibonacci-un-ponte-sul-mediterraneo/fibonaccis-significance-for-the-present-day/dDevelopment-of-numeral-systems.html)</sup>。

印度体系的决定性优势不在于选择 10 本身——因为希腊人和罗马人也以十计数——而在于它可以让任意大的数只用不超过十个符号来表示，办法是赋予每个符号一个取决于其位置的位值<sup>[12](https://mathshistory.st-andrews.ac.uk/Extras/Rudio_talk/)</sup>。相比之下，罗马数字纯粹靠数值相加来构成数字，这使得笔算几乎不可能进行；人们只能借助算盘<sup>[5](https://library.ethz.ch/en/collections-and-archives/platforms/virtual-exhibitions/fibonacci-un-ponte-sul-mediterraneo/fibonaccis-significance-for-the-present-day/dDevelopment-of-numeral-systems.html)</sup>。

## 计算中的基数

二进制、八进制和十六进制是现代技术时代重要的记数制<sup>[4](https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructures/Chapter4/integer-representations.html)</sup>。数字设备使用只有 0 和 1 两个数字的二进制系统，而编程则需要精确理解二进制、八进制、十进制和十六进制系统及其相互转换<sup>[13](https://arxiv.org/abs/1107.1663)</sup>。从十进制转换到二进制，可以反复除以 2 并记下余数来完成<sup>[2](https://courses.cs.vt.edu/~cs2505/fall2010/Notes/pdf/T01.NumericBases.pdf)</sup>。

编程语言直接暴露基数。Python 的内置函数 `int(string, base)` 把原数所用的基数作为第二个可选参数，因此 `int('0x144', 16) == 324`；当基数为 0 时，前缀 `0o` 表示八进制，`0x` 表示十六进制<sup>[14](https://docs.python.org/3/faq/programming.html?highlight=unboundlocalerror)</sup>。

浮点标准也涉及基数。IEEE 854-1987《与基数无关的浮点算术标准》规定了浮点参数的约束，而不限定于某一特定基数；而 IEEE 754 则分别规定了二进制浮点算术和十进制浮点算术<sup>[8](https://standards.ieee.org/ieee/754/6210/)</sup>。

## 基数排序

这个术语还指称一类算法。基数排序根据键的各数位上的值把记录分配到各个桶中，从最右边的数字开始，一直到最左边的数字；它之所以叫这个名字，是因为分桶的计算基于键值的基数或底数<sup>[7](https://opendsa-server.cs.vt.edu/ODSA/Books/wfu/csc201-b/fall-2026/201B/html/RadixSort.html)</sup>。它是一种非比较排序算法<sup>[15](https://cgi.cse.unsw.edu.au/~cs2521/19T1/lecs/week07b/)</sup>。

趟数取决于所选的基数。因为表示
(n) 个不同的键值至少需要
(\log_r n) 个基数
(r) 的数字，所以对
(n) 个不同的键，基数排序在一般情况下最好也只是
(\Omega(n \log n)) 算法<sup>[7](https://opendsa-server.cs.vt.edu/ODSA/Books/wfu/csc201-b/fall-2026/201B/html/RadixSort.html)</sup>。把基数取得尽可能大能带来常数因子的运行时间改善：令
(r = 2^i) 可使基数与每趟处理的位数挂钩，于是每趟处理的位数每翻一番，趟数就减半。当
(r = 256) 时，一个 32 位整数键只需四趟，每字节一趟；而
(r = 2^{16}) 可把趟数减到两趟，代价是需要一个大小为 64K 的计数数组，并且只有在记录数大约为 64K 或更多时才有良好表现<sup>[7](https://opendsa-server.cs.vt.edu/ODSA/Books/wfu/csc201-b/fall-2026/201B/html/RadixSort.html)</sup>。

## 数字、文字与区域设置

基数概念也是字符编码的基础。Unicode 标准将数值类型（Numeric_Type）为十进制（Decimal）的字符定义为用于十进制数的字符，它们被编码在一个连续的范围内，数值（Numeric_Value）递增，且数字零是第一个码位；中日韩表意数字被排除在外，因为它们并非按连续序列编码<sup>[16](https://www.unicode.org/versions/Unicode18.0.0/core-spec/chapter-4/)</sup>。排列成序列来表示十进制数的十进制数字，总是按最高有效位在前的顺序存储，即使对于版面自右向左书写的文字也是如此<sup>[17](https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-22/)</sup>。

并非每一种数字书写系统都是这种意义上的基数系统。作为书写十进制数字的系统，罗马数字、希腊首音记数法（Greek acrophonic numerals）和东亚表意数字，在形式意义上都不算十进制基数数字系统<sup>[18](https://www.unicode.org/versions/Unicode12.1.0/ch05.pdf)</sup>。传统的中文系统使用表示十、百、千、万等等的数值符号，而不是十进位值结构<sup>[17](https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-22/)</sup>。区域设置数据随后提供某种语言使用哪一套数字、小数分隔符和分组惯例，因为 Unicode 标准本身并不规定哪些数字集属于任何特定的书写系统或区域<sup>[17](https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-22/)</sup>。

## References

1. [Number Systems, Base 10, 5 and 2, UTSA Department of Mathematics](https://mathresearch.utsa.edu/wiki/index.php?title=Number_Systems,_Base_10,_5_and_2)
2. [Numeric Bases, Virginia Tech CS 2505 course notes](https://courses.cs.vt.edu/~cs2505/fall2010/Notes/pdf/T01.NumericBases.pdf)
3. [Number Systems (MCS-404), Uttarakhand Open University](https://uou.ac.in/sites/default/files/slm/MCS-404.pdf)
4. [Integer Representations, Discrete Structures for Computing, Western University](https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructures/Chapter4/integer-representations.html)
5. [Development of numeral systems, ETH Library](https://library.ethz.ch/en/collections-and-archives/platforms/virtual-exhibitions/fibonacci-un-ponte-sul-mediterraneo/fibonaccis-significance-for-the-present-day/dDevelopment-of-numeral-systems.html)
6. [Indian numerals, MacTutor History of Mathematics](https://mathshistory.st-andrews.ac.uk//HistTopics/Indian_numerals/)
7. [8.14. Radix Sort, CSC 201 Data Structures & Algorithms](https://opendsa-server.cs.vt.edu/ODSA/Books/wfu/csc201-b/fall-2026/201B/html/RadixSort.html)
8. [IEEE 754-2019 and related standards, IEEE SA](https://standards.ieee.org/ieee/754/6210/)
9. [Early Numeration Systems, Contemporary Mathematics, OpenStax](https://openstax.org/books/contemporary-mathematics/pages/4-2-early-numeration-systems)
10. [Zero, MacTutor History of Mathematics](https://mathshistory.st-andrews.ac.uk/HistTopics/Zero/)
11. [Arabic numerals, MacTutor History of Mathematics](https://mathshistory.st-andrews.ac.uk/HistTopics/Arabic_numerals/)
12. [Rudio's talk, MacTutor History of Mathematics](https://mathshistory.st-andrews.ac.uk/Extras/Rudio_talk/)
13. [A Step towards an Easy Interconversion of Various Number Systems, arXiv](https://arxiv.org/abs/1107.1663)
14. [Programming FAQ, Python documentation](https://docs.python.org/3/faq/programming.html?highlight=unboundlocalerror)
15. [Sorting, COMP2521 lecture notes, UNSW](https://cgi.cse.unsw.edu.au/~cs2521/19T1/lecs/week07b/)
16. [Chapter 4, The Unicode Standard, Version 18.0.0](https://www.unicode.org/versions/Unicode18.0.0/core-spec/chapter-4/)
17. [Chapter 22, The Unicode Standard, Version 16.0.0](https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-22/)
18. [Chapter 5, The Unicode Standard, Version 12.0](https://www.unicode.org/versions/Unicode12.1.0/ch05.pdf)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Arithmetic and number systems › Number systems › Integers and rational numbers

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/radix

English original: https://www.edgepedia.org/radix
