BitLength
BitLength[n]
给出表示整数 n 所必要的二进位的数目.
范例
打开所有单元 关闭所有单元基本范例 (2)
范围 (2)
绘制范围较大的正数的 BitLength:
DiscretePlot[BitLength[n], {n, 2 ^ 10 - 1}, PlotRange -> All]BitLength[1000!]属性和关系 (4)
BitLength[0] 的结果为 1:
BitLength[0]对于正的 n,BitLength[n] 等价于 Floor[Log[2,n]]+1:
With[{n = RandomInteger[{1, 2 ^ 32 - 1}]}, BitLength[n] == Floor[Log[2, n]] + 1]对于负的 n,BitLength[n] 等价于 BitLength[BitNot[n]]:
With[{n = RandomInteger[{1, 2 ^ 32 - 1}]}, BitLength[n] == BitLength[BitNot[n]]]BitLength 关于
对称:
DiscretePlot[BitLength[n], {n, -20, 20}, PlotMarkers -> {Automatic, 8}]技术笔记
文本
Wolfram Research (2007),BitLength,Wolfram 语言函数,https://reference.wolfram.com/language/ref/BitLength.html.
CMS
Wolfram 语言. 2007. "BitLength." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/BitLength.html.
APA
Wolfram 语言. (2007). BitLength. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/BitLength.html 年
BibTeX
@misc{reference.wolfram_2026_bitlength, author="Wolfram Research", title="{BitLength}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/BitLength.html}", note=[Accessed: 10-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_bitlength, organization={Wolfram Research}, title={BitLength}, year={2007}, url={https://reference.wolfram.com/language/ref/BitLength.html}, note=[Accessed: 10-August-2026]}