Skip to content

The leading digit of a power of two

Posted on:

Write out the powers of two and keep only the first digit:

2,4,8,16,32,64,128,256,512,1024,    2,4,8,1,3,6,1,2,5,1,2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, \ldots \;\longrightarrow\; 2, 4, 8, 1, 3, 6, 1, 2, 5, 1, \ldots

The digits are not equally common. Among the first hundred powers of two, exactly thirty begin with 1, while only five begin with 9. Push NN to a million and the shares settle near 30.1% for the digit 1 and 4.6% for the digit 9. The limiting frequency of leading digit dd is

log10 ⁣(1+1d),\log_{10}\!\left(1 + \frac{1}{d}\right),

and this is a theorem, not an empirical tendency. The derivation needs one change of viewpoint and one classical result about rotations of the circle.

The fractional part carries the digit

Since 2n=10nlog1022^n = 10^{\,n \log_{10} 2}, split the exponent into its integer and fractional parts, nlog102=m+fn \log_{10} 2 = m + f with f={nlog102}[0,1)f = \{n \log_{10} 2\} \in [0, 1). Then

2n=10m10f,10f[1,10),2^n = 10^m \cdot 10^f, \qquad 10^f \in [1, 10),

so 10f10^f is the mantissa of 2n2^n: the number with the same digits but the decimal point after the first one. The leading digit is dd exactly when d10f<d+1d \le 10^f < d + 1, that is, when

f[log10d,  log10(d+1)).f \in [\log_{10} d,\; \log_{10}(d+1)).

The nine digits partition [0,1)[0,1) into nine intervals, and the interval for digit dd has length log10(d+1)log10d=log10(1+1/d)\log_{10}(d+1) - \log_{10} d = \log_{10}(1 + 1/d). Digit 1 owns [0,0.30103)[0, 0.30103), almost a third of the circle; digit 9 owns the sliver [0.95424,1)[0.95424, 1) of length 0.045760.04576. The whole question is now: how do the fractional parts fn={nα}f_n = \{n\alpha\}, with α=log102\alpha = \log_{10} 2, distribute over [0,1)[0,1)?

One structural fact first: α\alpha is irrational. If log102=p/q\log_{10} 2 = p/q with positive integers p,qp, q, then 2q=10p=2p5p2^q = 10^p = 2^p 5^p, which forces a power of 5 to equal a power of 2; unique factorization says no. Consequently the points fnf_n are all distinct (a repeat fn=fnf_n = f_{n'} would make (nn)α(n - n')\alpha an integer), and the sequence never becomes periodic.

Equidistribution

The map f{f+α}f \mapsto \{f + \alpha\} is a rotation of the circle by the irrational angle α\alpha, and fnf_n is the orbit of 00 under that rotation. The equidistribution theorem says that such an orbit spreads uniformly: for every interval [a,b)[0,1)[a, b) \subseteq [0,1),

#{nN:{nα}[a,b)}N    baas N.\frac{\#\{\, n \le N : \{n\alpha\} \in [a,b) \,\}}{N} \;\longrightarrow\; b - a \qquad \text{as } N \to \infty.

Applied to the digit intervals, this is the whole result: the frequency of leading digit dd among the powers of two converges to log10(1+1/d)\log_{10}(1 + 1/d).

The proof runs through Weyl’s criterion: a sequence (fn)(f_n) is equidistributed in [0,1)[0,1) if and only if, for every nonzero integer hh, the exponential averages vanish in the limit,

1Nn=1Ne2πihfn    0.\frac{1}{N} \sum_{n=1}^{N} e^{2\pi i h f_n} \;\longrightarrow\; 0.

The criterion converts a statement about counting into a statement about cancellation, and for the rotation orbit the cancellation is a finite geometric series:

n=1Ne2πihnα=e2πihαe2πihNα1e2πihα12e2πihα1=1sin(πhα).\left| \sum_{n=1}^{N} e^{2\pi i h n \alpha} \right| = \left| e^{2\pi i h \alpha}\,\frac{e^{2\pi i h N \alpha} - 1}{e^{2\pi i h \alpha} - 1} \right| \le \frac{2}{\left| e^{2\pi i h \alpha} - 1 \right|} = \frac{1}{\left| \sin(\pi h \alpha) \right|}.

Irrationality of α\alpha guarantees hαh\alpha is never an integer, so the bound is finite, and crucially it does not grow with NN: dividing by NN sends the average to zero. (The other half of the criterion, that killing all the exponentials forces uniform counting, follows by sandwiching the indicator function of an interval between trigonometric polynomials; Kuipers and Niederreiter give the two-page argument.)

The nine limiting frequencies, to four places:

dd123456789
log10(1+1/d)\log_{10}(1+1/d).3010.1761.1249.0969.0792.0669.0580.0512.0458

The drift, made visible

The convergence has a fine structure worth seeing. Ten doublings multiply by 210=10242^{10} = 1024, which is three orders of magnitude and a little more: {10α}=0.0103\{10\alpha\} = 0.0103. So after every ten steps the mantissa returns almost to where it started, multiplied by 100.0103=1.02410^{0.0103} = 1.024. The leading-digit sequence therefore repeats the block

1,2,4,8,1,3,6,1,2,51, 2, 4, 8, 1, 3, 6, 1, 2, 5

over and over, with each slot creeping upward by 2.4% per cycle. The pattern only changes when a slot’s mantissa crosses a digit boundary, and the crossings are what equidistribution looks like at ground level. Follow the slot that starts at 64:

26=64,216=65536,2266.71107,2366.871010,2467.041013.2^6 = 64, \quad 2^{16} = 65536, \quad 2^{26} \approx 6.71 \cdot 10^7, \quad 2^{36} \approx 6.87 \cdot 10^{10}, \quad 2^{46} \approx 7.04 \cdot 10^{13}.

Four cycles of 2.4% push 6.4 over 7, and 2462^{46} is the first power of two whose decimal expansion starts with 7. The slot that starts at 8 takes even longer to cross:

8,8192,8388608,8.59109,8.801012,9.011015,8, \quad 8192, \quad 8388608, \quad 8.59 \cdot 10^9, \quad 8.80 \cdot 10^{12}, \quad 9.01 \cdot 10^{15},

so the first power of two starting with 9 is 253=90071992547409922^{53} = 9007199254740992. (The same number is where double-precision floating point stops representing consecutive integers exactly: JavaScript’s Number.MAX_SAFE_INTEGER is 25312^{53} - 1. The two facts are unrelated, but it is a good number to recognize on sight.) After the ten-step near-period, the next much better rational approximation to α\alpha is 28/9328/93: ninety-three doublings land within a whisker of twenty-eight decades, 2939.9010272^{93} \approx 9.90 \cdot 10^{27}, so the residual drift of the ten-step pattern itself nearly repeats every 93 steps.

The widget counts the leading digits of 21,,2N2^1, \ldots, 2^N exactly, by accumulating {nα}\{n\alpha\}; nothing is sampled. At small NN the shares visibly disagree with the limit (the digit-7 share is exactly zero until N=46N = 46), and the disagreement fades as the boundary crossings accumulate:

N = 100share of digit 1 = 30.0%
exact share among 2¹ … 2ᴺlimit log₁₀(1 + 1/d)

Scale invariance and Benford’s law

The powers of two are the clean, provable case of a broader phenomenon. Benford’s law is the empirical observation that many datasets assembled from the world (populations, physical constants, accounting ledgers) show roughly these same leading-digit frequencies. For data there is no theorem forcing this, but there is a theorem explaining which data should show it: a scale-invariance argument.

Suppose the leading-digit distribution of a positive random quantity XX does not change when the units change, that is, cXcX has the same leading-digit distribution as XX for every constant c>0c > 0. The leading digit of XX depends only on Y={log10X}Y = \{\log_{10} X\}, and multiplying by cc translates YY by log10c\log_{10} c modulo 1. Unit-invariance for all cc therefore says the distribution of YY on the circle is invariant under every rotation. Its Fourier coefficients then satisfy φ(h)=e2πihtφ(h)\varphi(h) = e^{2\pi i h t}\,\varphi(h) for all shifts tt, forcing φ(h)=0\varphi(h) = 0 for every h0h \ne 0: YY is uniform, and the digit frequencies are log10(1+1/d)\log_{10}(1 + 1/d), the same computation as before.

The honest reading runs in one direction only. Nothing obliges a dataset to be scale-invariant, and plenty are not (adult heights in metres have no Benford behavior at all). The law tends to appear in data with wide dynamic range or multiplicative growth, where no single scale is privileged, and its failure in data that should have it is what forensic accountants use as a screening flag, a heuristic rather than a proof. For 2n2^n none of these hedges are needed: multiplicative growth is the definition of the sequence, and equidistribution does the rest.

A little history

The observation predates the name by decades. Simon Newcomb noticed in 1881 that the front pages of shared logarithm tables, the ones for numbers beginning with 1, were the most worn, and proposed the logarithmic law in a two-page note. Frank Benford, a physicist at General Electric, rediscovered it in 1938 and tested it against 20,229 numbers drawn from river areas, street addresses, molecular weights, and more; the law took his name. The equidistribution theorem for {nα}\{n\alpha\} was proved independently around 1909–1910 by Bohl, Sierpiński, and Weyl, and Weyl’s 1916 paper recast it as the exponential-sum criterion used above, a tool that went on to power large parts of analytic number theory. The application to leading digits, along with much finer results, is laid out in Diaconis’s 1977 paper.

References



Next Post
Percolation