主题
Search

位长


BitLength

表示一个数字所需的二进制位数,明确地由下式给出

BL(n)=1+|_lgn_|
(1)
=[lg(n+1)],
(2)

其中 [x]向上取整函数|_x_|向下取整函数,并且 lgnlg,以 2 为底的对数。对于 n=0, 1, 2, ..., 位长序列由 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, ... (OEIS A029837) 给出。该函数由 Wolfram 语言函数给出BitLength[n]。


使用 Wolfram|Alpha 探索

参考文献

Sloane, N. J. A. 序列 A029837 在 "整数序列在线百科全书" 中。

引用此内容为

Weisstein, Eric W. "位长。" 来自 MathWorld--Wolfram Web 资源。 https://mathworld.net.cn/BitLength.html

主题分类