In “Wake the Snake”, I looked at the digits of powers of 2 and mentioned a fascinating mathematical phenomenon known as Benford’s law, which governs — in a not-yet-fully-explained way — the leading digits of a wide variety of natural and human statistics, from the lengths of rivers to the votes cast in elections. Benford’s law also governs a lot of mathematical data. It states, for example, that the first digit, d, of a power of 2 in base b (except b = 2, 4, 8, 16…) will occur with the frequency logb(1 + 1/d). In base 10, therefore, Benford’s law states that the digits 1..9 will occur with the following frequencies at the beginning of 2^p:
1: 30.102999%
2: 17.609125%
3: 12.493873%
4: 09.691001%
5: 07.918124%
6: 06.694678%
7: 05.799194%
8: 05.115252%
9: 04.575749%
Here’s a graph of the actual relative frequencies of 1..9 as the leading digit of 2^p (open images in a new window if they appear distorted):
And here’s a graph for the predicted frequencies of 1..9 as the leading digit of 2^p, as calculated by the log(1+1/d) of Benford’s law:
The two graphs agree very well. But Benford’s law applies to more than one leading digit. Here are actual and predicted graphs for the first two leading digits of 2^p, 10..99:
And actual and predicted graphs for the first three leading digits of 2^p, 100..999:
But you can represent the leading digit of 2^p in another way: using an adaptation of the famous Ulam spiral. Suppose powers of 2 are represented as a spiral of squares that begins like this, with 2^0 in the center, 2^1 to the right of center, 2^2 above 2^1, and so on:
←←←⮲
432↑
501↑
6789
If the digits of 2^p start with 1, fill the square in question; if the digits of 2^p don’t start with 1, leave the square empty. When you do this, you get this interesting pattern (the purple square at the very center represents 2^0):
Ulam-like power-spiral for 2^p where 1 is the leading digit
Here’s a higher-resolution power-spiral for 1 as the leading digit:
Power-spiral for 2^p, leading-digit = 1 (higher resolution)
And here, at higher resolution still, are power-spirals for all the possible leading digits of 2^p, 1..9 (some spirals look very similar, so you have to compare those ones carefully):
Power-spiral for 2^p, leading-digit = 1 (very high resolution)
Power-spiral for 2^p, leading-digit = 2
Power-spiral for 2^p, ld = 3
Power-spiral for 2^p, ld = 4
Power-spiral for 2^p, ld = 5
Power-spiral for 2^p, ld = 6
Power-spiral for 2^p, ld = 7
Power-spiral for 2^p, ld = 8
Power-spiral for 2^p, ld = 9
Power-spiral for 2^p, ld = 1..9 (animated)
Now try the power-spiral of 2^p, ld = 1, in some other bases:
Power-spiral for 2^p, leading-digit = 1, base = 9
Power-spiral for 2^p, ld = 1, b = 15
You can also try power-spirals for other n^p. Here’s 3^p:
Power-spiral for 3^p, ld = 1, b = 10
Power-spiral for 3^p, ld = 2, b = 10
Power-spiral for 3^p, ld = 1, b = 4
Power-spiral for 3^p, ld = 1, b = 7
Power-spiral for 3^p, ld = 1, b = 18
Elsewhere Other-Accessible…
• Wake the Snake — an earlier look at the digits of 2^p