# Root Pursuit

Roots are hard, powers are easy. For example, the square root of 2, or √2, is the mysterious and never-ending number that is equal to 2 when multiplied by itself:

• √2 = 1·414213562373095048801688724209698078569671875376948073...

It’s hard to calculate √2. But the powers of 2, or 2^p, are the straightforward numbers that you get by multiplying 2 repeatedly by itself. It’s easy to calculate 2^p:

• 2 = 2^1
• 4 = 2^2
• 8 = 2^3
• 16 = 2^4
• 32 = 2^5
• 64 = 2^6
• 128 = 2^7
• 256 = 2^8
• 512 = 2^9
• 1024 = 2^10
• 2048 = 2^11
• 4096 = 2^12
• 8192 = 2^13
• 16384 = 2^14
• 32768 = 2^15
• 65536 = 2^16
• 131072 = 2^17
• 262144 = 2^18
• 524288 = 2^19
• 1048576 = 2^20
[...]

But there is a way to find √2 by finding 2^p, as I discovered after I asked a simple question about 2^p and 3^p. What are the longest runs of matching digits at the beginning of each power?

131072 = 2^17
129140163 = 3^17
1255420347077336152767157884641... = 2^193
1214512980685298442335534165687... = 3^193
2175541218577478036232553294038... = 2^619
2177993962169082260270654106078... = 3^619
7524389324549354450012295667238... = 2^2016
7524012611682575322123383229826... = 3^2016

There’s no obvious pattern. Then I asked the same question about 2^p and 5^p. And an interesting pattern appeared:

32 = 2^5
3125 = 5^5
316912650057057350374175801344 = 2^98
3155443620884047221646914261131... = 5^98
3162535207926728411757739792483... = 2^1068
3162020133383977882730040274356... = 5^1068
3162266908803418110961625404267... = 2^127185
3162288411569894029343799063611... = 5^127185

The digits 31622 rang a bell. Isn’t that the start of √10? Yes, it is:

• √10 = 3·1622776601683793319988935444327185337195551393252168268575...

I wrote a fast machine-code program to find even longer runs of matching initial digits. Sure enough, the pattern continued:

• 316227... = 2^2728361
• 316227... = 5^2728361
• 3162277... = 2^15917834
• 3162277... = 5^15917834
• 31622776... = 2^73482154
• 31622776... = 5^73482154
• 3162277660... = 2^961700165
• 3162277660... = 5^961700165

But why are powers of 2 and 5 generating the digits of √10? If you’re good at math, that’s a trivial question about a trivial discovery. Here’s the answer: We use base ten and 10 = 2 * 5, 10^2 = 100 = 2^2 * 5^2 = 4 * 25, 10^3 = 1000 = 2^3 * 5^3 = 8 * 125, and so on. When the initial digits of 2^p and 5^p match, those matching digits must come from the digits of √10. Otherwise the product of 2^p * 5^p would be too large or too small. Here are the records for matching initial digits multiplied by themselves:

32 = 2^5
3125 = 5^5
• 3^2 = 9

316912650057057350374175801344 = 2^98
3155443620884047221646914261131... = 5^98
• 31^2 = 961

3162535207926728411757739792483... = 2^1068
3162020133383977882730040274356... = 5^1068
• 3162^2 = 9998244

3162266908803418110961625404267... = 2^127185
3162288411569894029343799063611... = 5^127185
• 31622^2 = 999950884

• 316227... = 2^2728361
• 316227... = 5^2728361
• 316227^2 = 99999515529

• 3162277... = 2^15917834
• 3162277... = 5^15917834
• 3162277^2 = 9999995824729

• 31622776... = 2^73482154
• 31622776... = 5^73482154
• 31622776^2 = 999999961946176

• 3162277660... = 2^961700165
• 3162277660... = 5^961700165
• 3162277660^2 = 9999999998935075600

The square of each matching run falls short of 10^p. And so when the digits of 2^p and 5^p stop matching, one power must fall below √10, as it were, and one must rise above:

3 162266908803418110961625404267... = 2^127185
3·162277660168379331998893544432... = √10
3 162288411569894029343799063611... = 5^127185

In this way, 2^p * 5^p = 10^p. And that’s why matching initial digits of 2^p and 5^p generate the digits of √10. The same thing, mutatis mutandis, happens in base 6 with 2^p and 3^p, because 6 = 2 * 3:

• 2.24103122055214532500432040411... = √6 (in base 6)

24 = 2^4
213 = 3^4
225522024 = 2^34 in base 6 = 2^22 in base 10
22225525003213 = 3^34 (3^22)
2241525132535231233233555114533... = 2^1303 (2^327)
2240133444421105112410441102423... = 3^1303 (3^327)
2241055222343212030022044325420... = 2^153251 (2^15007)
2241003215453455515322105001310... = 3^153251 (3^15007)
2241032233315203525544525150530... = 2^233204 (2^20164)
2241030204225410320250422435321... = 3^233204 (3^20164)
2241031334114245140003252435303... = 2^2110415 (2^102539)
2241031103430053425141014505442... = 3^2110415 (3^102539)

And in base 30, where 30 = 2 * 3 * 5, you can find the digits of √30 in three different ways, because 30 = 2 * 15 = 3 * 10 = 5 * 6:

• 5·E9F2LE6BBPBF0F52B7385PE6E5CLN... = √30 (in base 30)

55AA4 = 2^M in base 30 = 2^22 in base 10
5NO6CQN69C3Q0E1Q7F = F^M = 15^22
5E63NMOAO4JPQD6996F3HPLIMLIRL6F... = 2^K6 (2^606)
5ECQDMIOCIAIR0DGJ4O4H8EN10AQ2GR... = F^K6 (15^606)
5E9DTE7BO41HIQDDO0NB1MFNEE4QJRF... = 2^B14 (2^9934)
5E9G5SL7KBNKFLKSG89J9J9NT17KHHO... = F^B14 (15^9934)
[...]
5R4C9 = 3^E in base 30 = 3^14 in base 10
52CE6A3L3A = A^E = 10^14
5E6SOQE5II5A8IRCH9HFBGO7835KL8A = 3^3N (3^113)
5EC1BLQHNJLTGD00SLBEDQ73AH465E3... = A^3N (10^113)
5E9FI455MQI4KOJM0HSBP3GG6OL9T8P... = 3^EJH (3^13187)
5E9EH8N8D9TR1AH48MT7OR3MHAGFNFQ... = A^EJH (10^13187)
[...]
5OCNCNRAP = 5^I in base 30 = 5^18 in base 10
54NO22GI76 = 6^I (6^18)
5EG4RAMD1IGGHQ8QS2QR0S0EH09DK16... = 5^1M7 (5^1567)
5E2PG4Q2G63DOBIJ54E4O035Q9TEJGH... = 6^1M7 (6^1567)
5E96DB9T6TBIM1FCCK8A8J7IDRCTM71... = 5^F9G (5^13786)
5E9NM222PN9Q9TEFTJ94261NRBB8FCH... = 6^F9G (6^13786)
[...]

So that’s √10, √6 and √30. But I said at the beginning that you can find √2 by finding 2^p. How do you do that? By offsetting the powers, as it were. With 2^p and 5^p, you can find the digits of √10. With 2^(p+1) and 5^p, you can find the digits of √2 and √20, because 2^(p+1) * 5^p = 2 * 2^p * 5^p = 2 * 10^p:

•  √2 = 1·414213562373095048801688724209698078569671875376948073...
• √20 = 4·472135954999579392818347337462552470881236719223051448...

16 = 2^4
125 = 5^3
140737488355328 = 2^47
142108547152020037174224853515625 = 5^46
1413... = 2^243
1414... = 5^242
14141... = 2^6651
14142... = 5^6650
141421... = 2^35389
141420... = 5^35388
4472136... = 2^162574
4472135... = 5^162573
141421359... = 2^3216082
141421352... = 5^3216081
447213595... = 2^172530387
447213595... = 5^172530386
[...]

# God Give Me Benf’

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

# Wake the Snake

In my story “Kopfwurmkundalini”, I imagined the square root of 2 as an infinitely long worm or snake whose endlessly varying digit-segments contained all stories ever (and never) written:

• √2 = 1·414213562373095048801688724209698078569671875376948073…

But there’s another way to get all stories ever written from the number 2. You don’t look at the root(s) of 2, but at the powers of 2:

• 2 = 2^1 = 2
• 4 = 2^2 = 2*2
• 8 = 2^3 = 2*2*2
• 16 = 2^4 = 2*2*2*2
• 32 = 2^5 = 2*2*2*2*2
• 64 = 2^6 = 2*2*2*2*2*2
• 128 = 2^7 = 2*2*2*2*2*2*2
• 256 = 2^8 = 2*2*2*2*2*2*2*2
• 512 = 2^9 = 2*2*2*2*2*2*2*2*2
• 1024 = 2^10
• 2048 = 2^11
• 4096 = 2^12
• 8192 = 2^13
• 16384 = 2^14
• 32768 = 2^15
• 65536 = 2^16
• 131072 = 2^17
• 262144 = 2^18
• 524288 = 2^19
• 1048576 = 2^20
• 2097152 = 2^21
• 4194304 = 2^22
• 8388608 = 2^23
• 16777216 = 2^24
• 33554432 = 2^25
• 67108864 = 2^26
• 134217728 = 2^27
• 268435456 = 2^28
• 536870912 = 2^29
• 1073741824 = 2^30
[...]

The powers of 2 are like an ever-lengthening snake swimming across a pool. The snake has an endlessly mutating head and a rhythmically waving tail with a regular but ever-more complex wake. That is, the leading digits of 2^p don’t repeat but the trailing digits do. Look at the single final digit of 2^p, for example:

• 02 = 2^1
• 04 = 2^2
• 08 = 2^3
• 16 = 2^4
• 32 = 2^5
• 64 = 2^6
• 128 = 2^7
• 256 = 2^8
• 512 = 2^9
• 1024 = 2^10
• 2048 = 2^11
• 4096 = 2^12
• 8192 = 2^13
• 16384 = 2^14
• 32768 = 2^15
• 65536 = 2^16
• 131072 = 2^17
• 262144 = 2^18
• 524288 = 2^19
• 1048576 = 2^20
• 2097152 = 2^21
• 4194304 = 2^22
[...]

The final digit of 2^p falls into a loop: 2 → 4 → 8 → 6 → 2 → 4→ 8…

Now try the final two digits of 2^p:

02 = 2^1
04 = 2^2
08 = 2^3
16 = 2^4
32 = 2^5
64 = 2^6
• 128 = 2^7
• 256 = 2^8
• 512 = 2^9
• 1024 = 2^10
• 2048 = 2^11
• 4096 = 2^12
• 8192 = 2^13
• 16384 = 2^14
• 32768 = 2^15
• 65536 = 2^16
• 131072 = 2^17
• 262144 = 2^18
• 524288 = 2^19
• 1048576 = 2^20
• 2097152 = 2^21
• 4194304 = 2^22
• 8388608 = 2^23
• 16777216 = 2^24
• 33554432 = 2^25
• 67108864 = 2^26
• 134217728 = 2^27
• 268435456 = 2^28
• 536870912 = 2^29
• 1073741824 = 2^30
[...]

Now there’s a longer loop: 02 → 04 → 08 → 16 → 32 → 64 → 28 → 56 → 12 → 24 → 48 → 96 → 92 → 84 → 68 → 36 → 72 → 44 → 88 → 76 → 52 → 04 → 08 → 16 → 32 → 64 → 28… Any number of trailing digits, 1 or 2 or one trillion, falls into a loop. It just takes longer as the number of trailing digits increases.

That’s the tail of the snake. At the other end, the head of the snake, the digits don’t fall into a loop (because of the carries from the lower digits). So, while you can get only 2, 4, 8 and 6 as the final digits of 2^p, you can get any digit but 0 as the first digit of 2^p. Indeed, I conjecture (but can’t prove) that not only will all integers eventually appear as the leading digits of 2^p, but they will do so infinitely often. Think of a number and it will appear as the leading digits of 2^p. Let’s try the numbers 1, 12, 123, 1234, 12345…:

16 = 2^4
128 = 2^7
12379400392853802748... = 2^90
12340799625835686853... = 2^1545
12345257952011458590... = 2^34555
12345695478410965346... = 2^63293
12345673811591269861... = 2^4869721
12345678260232358911... = 2^5194868
12345678999199154389... = 2^62759188

But what about the numbers 9, 98, 987, 986, 98765… as leading digits of 2^p? They don’t appear as quickly:

9007199254740992 = 2^53
98079714615416886934... = 2^186
98726397006685494828... = 2^1548
98768356967522174395... = 2^21257
98765563827287722773... = 2^63296
98765426081858871289... = 2^5194871
98765430693066680199... = 2^11627034
98765432584491513519... = 2^260855656
98765432109571471006... = 2^1641098748

Why do fragments of 123456789 appear much sooner than fragments of 987654321? Well, even though all integers occur infinitely often as leading digits of 2^p, some integers occur more often than others, as it were. The leading digits of 2^p are actually governed by a fascinating mathematical phenomenon known as Benford’s law, which states, for example, that the single first digit, d, will occur with the frequency log10(1 + 1/d). Here are the actual frequencies of 1..9 for all powers of 2 up to 2^101000, compared with the estimate by Benford’s law:

1: 30% of leading digits ↔ 30.1% estimated
2: 17.55% ↔ 17.6%
3: 12.45% ↔ 12.49%
4: 09.65% ↔ 9.69%
5: 07.89% ↔ 7.92%
6: 06.67% ↔ 6.69%
7: 05.77% ↔ 5.79%
8: 05.09% ↔ 5.11%
9: 04.56% ↔ 4.57%

Because (inter alia) 1 appears as the first digit of 2^p far more often than 9 does, the fragments of 123456789 appear faster than the fragments of 987654321. Mutatis mutandis, the same applies in all other bases (apart from bases that are powers of 2, where there’s a single leading digit, 1, 2, 4, 8…, followed by 0s). But although a number like 123456789 occurs much frequently than 987654321 in 2^p expressed in base 10 (and higher), both integers occur infinitely often.

As do all other integers. And because stories can be expressed as numbers, all stories ever (and never) written appear in the powers of 2. Infinitely often. You’ll just have to trim the tail of the story-snake.

# Weight-Botchers

Suppose you have a balance scale and four weights of 1 unit, 2 units, 4 units and 8 units. How many different weights can you match? If you know binary arithmetic, it’s easy to see that you can match any weight up to fifteen units inclusive. With the object in the left-hand pan of the scale and the weights in the right-hand pan, these are the matches:

01 = 1
02 = 2
03 = 2+1
04 = 4
05 = 4+1
06 = 4+2
07 = 4+2+1
08 = 8
09 = 8+1
10 = 8+2
11 = 8+2+1
12 = 8+4
13 = 8+4+1
14 = 8+4+2
15 = 8+4+2+1

Balance scale

The weights that sum to n match the 1s in the digits of n in binary.

01 = 0001 in binary
02 = 0010 = 2
03 = 0011 = 2+1
04 = 0100 = 4
05 = 0101 = 4+1
06 = 0110 = 4+2
07 = 0111 = 4+2+1
08 = 1000 = 8
09 = 1001 = 8+1
10 = 1010 = 8+2
11 = 1011 = 8+2+1
12 = 1100 = 8+4
13 = 1101 = 8+4+1
14 = 1110 = 8+4+2
15 = 1111 = 8+4+2+1

But there’s another set of four weights that will match anything from 1 unit to 40 units. Instead of using powers of 2, you use powers of 3: 1, 3, 9, 27. But how would you match an object weighing 2 units using these weights? Simple. You put the object in the left-hand scale, the 3-weight in the right-hand scale, and then add the 1-weight to the left-hand scale. In other words, 2 = 3-1. Similarly, 5 = 9-3-1, 6 = 9-3 and 7 = 9-3+1. When the power of 3 is positive, it’s in the right-hand pan; when it’s negative, it’s in the left-hand pan.

This system is actually based on base 3 or ternary, which uses three digits, 0, 1 and 2. However, the relationship between ternary numbers and the sums of positive and negative powers of 3 is more complicated than the relationship between binary numbers and sums of purely positive powers of 2. See if you can work out how to derive the sums in the middle from the ternary numbers on the right:

01 = 1 = 1 in ternary
02 = 3-1 = 2
03 = 3 = 10
04 = 3+1 = 11
05 = 9-3-1 = 12
06 = 9-3 = 20
07 = 9-3+1 = 21
08 = 9-1 = 22
09 = 9 = 100
10 = 9+1 = 101
11 = 9+3-1 = 102
12 = 9+3 = 110
13 = 9+3+1 = 111
14 = 27-9-3-1 = 112
15 = 27-9-3 = 120
16 = 27-9-3+1 = 121
17 = 27-9-1 = 122
18 = 27-9 = 200
19 = 27-9+1 = 201
20 = 27-9+3-1 = 202
21 = 27-9+3 = 210
22 = 27-9+3+1 = 211
23 = 27-3-1 = 212
24 = 27-3 = 220
25 = 27-3+1 = 221
26 = 27-1 = 222
27 = 27 = 1000
28 = 27+1 = 1001
29 = 27+3-1 = 1002
30 = 27+3 = 1010
31 = 27+3+1 = 1011
32 = 27+9-3-1 = 1012
33 = 27+9-3 = 1020
34 = 27+9-3+1 = 1021
35 = 27+9-1 = 1022
36 = 27+9 = 1100
37 = 27+9+1 = 1101
38 = 27+9+3-1 = 1102
39 = 27+9+3 = 1110
40 = 27+9+3+1 = 1111

To begin understanding the sums, consider those ternary numbers containing only 1s and 0s, like n = 1011[3], which equals 31 in decimal. The sum of powers is straightforward, because all of them are positive and they’re easy to work out from the digits of n in ternary: 1011 = 1*3^3 + 0*3^2 + 1*3^1 + 1*3^0 = 27+3+1. Now consider n = 222[3] = 26 in decimal. Just as a decimal number consisting entirely of 9s is always 1 less than a power of 10, so a ternary number consisting entirely of 2s is always 1 less than a power of three:

999 = 1000 - 1 = 10^3 - 1 (decimal)
222 = 1000[3] - 1 (ternary) = 26 = 27-1 = 3^3 - 1 (decimal)

If a ternary number contains only 2s and is d digits long, it will be equal to 3^d – 1. But what about numbers containing a mixture of 2s, 1s and 0s? Well, all ternary numbers containing at least one 2 will have a negative power of 3 in the sum. You can work out the sum by using the following algorithm. Suppose the number is five digits long and the rightmost digit is digit #1 and the leftmost is digit #5:

01. i = 1, sum = 0, extra = 0, posi = true.
02. if posi = false, goto step 07.
03. if digit #i = 0, sum = sum + 0.
04. if digit #i = 1, sum = sum + 3^(i-1).
05. if digit #i = 2, sum = sum - 3^(i-1), extra = 3^5, posi = false.
06. goto step 10.
07. if digit #i = 0, sum = sum + 3^(i-1), extra = 0, posi = true.
08. if digit #i = 1, sum = sum - 3^(i-1).
09. if digit #i = 2, sum = sum + 0.
10. i = i+1. if i <= 5, goto step 2.
11. print sum + extra.

As the number of weights grows, the advantages of base 3 get bigger:

With 02 weights, base 3 reaches 04 and base 2 reaches 3: 04-3 = 1.
With 03 weights, base 3 reaches 13 and base 2 reaches 7: 13-7 = 6.
With 04 weights, 000040 - 0015 = 000025
With 05 weights, 000121 - 0031 = 000090
With 06 weights, 000364 - 0063 = 000301
With 07 weights, 001093 - 0127 = 000966
With 08 weights, 003280 - 0255 = 003025
With 09 weights, 009841 - 0511 = 009330
With 10 weights, 029524 - 1023 = 028501
With 11 weights, 088573 - 2047 = 086526
With 12 weights, 265720 - 4095 = 261625...

But what about base 4, or quaternary? With four weights of 1, 4, 16 and 64, representing powers of 4 from 4^0 to 4^3, you should be able to weigh objects from 1 to 85 units using sums of positive and negative powers. In fact, some weights can’t be matched. As you can see below, if n in base 4 contains a 2, it usually can’t be represented as a sum of positive and negative powers of 4 (one exception is 23 = 2*4 + 3 = 11 in base 10). Certain other numbers are also impossible to represent as that kind of sum:

1 = 1 ← 1
2 has no sum = 2
3 = 4-1 ← 3
4 = 4 ← 10 in base 4
5 = 4+1 ← 11 in base 4
6 has no sum = 12 in base 4
7 has no sum = 13
8 has no sum = 20
9 has no sum = 21
10 has no sum = 22
11 = 16-4-1 ← 23
12 = 16-4 ← 30
13 = 16-4+1 ← 31
14 has no sum = 32
15 = 16-1 ← 33
16 = 16 ← 100
17 = 16+1 ← 101
18 has no sum = 102
19 = 16+4-1 ← 103
20 = 16+4 ← 110
21 = 16+4+1 ← 111
22 has no sum = 112
23 has no sum = 113
24 has no sum = 120
25 has no sum = 121
26 has no sum = 122
27 has no sum = 123
[...]

With a more complicated balance scale, it’s possible to use weights representing powers of base 4 and base 5 (use two pans on each arm of the scale instead of one, placing the extra pan at the midpoint of the arm). But with a standard balance scale, base 3 is the champion. However, there is a way to do slightly better than standard base 3. You do it by botching the weights. Suppose you have four weights of 1, 4, 10 and 28 (representing 1, 3+1, 9+1 and 27+1). There are some weights n you can’t match, but because you can match n-1 and n+1, you know what these unmatchable weights are. Accordingly, while weights of 1, 3, 9 and 27 can measure objects up to 40 units, weights of 1, 4, 10 and 28 can measure objects up to 43 units:

1 = 1 ← 1
2 has no sum = 2
3 = 4-1 ← 10 in base 3
4 = 4 ← 11 in base 3
5 = 4+1 ← 12 in base 3
6 = 10-4 ← 20
7 = 10-4+1 ← 21
8 has no sum = 22
9 = 10-1 ← 100
10 = 10 ← 101
11 = 10+1 ← 102
12 has no sum = 110
13 = 10+4-1 ← 111
14 = 10+4 ← 112
15 = 10+4+1 ← 120
16 has no sum = 121
17 = 28-10-1 ← 122
18 = 28-10 ← 200
19 = 28-10+1 ← 201
20 has no sum = 202
21 = 28-10+4-1 ← 210
22 = 28-10+4 ← 211
23 = 28-4-1 ← 212
24 = 28-4 ← 220
25 = 28-4+1 ← 221
26 has no sum = 222
27 = 28-1 ← 1000
28 = 28 ← 1001
29 = 28+1 ← 1002
30 has no sum = 1010
31 = 28+4-1 ← 1011
32 = 28+4 ← 1012
33 = 28+4+1 ← 1020
34 = 28+10-4 ← 1021
35 = 28+10-4+1 ← 1022
36 has no sum = 1100
37 = 28+10-1 ← 1101
38 = 28+10 ← 1102
39 = 28+10+1 ← 1110
40 = has no sum = 1111*
41 = 28+10+4-1 ← 1112
42 = 28+10+4 ← 1120
43 = 28+10+4+1 ← 1121

*N.B. 40 = 82-28-10-4, i.e. has a sum when another botched weight, 82 = 3^4+1, is used.

# Shareway to Seven

An adaptation of an interesting distribution puzzle from Joseph Degrazia’s Math is Fun (1954):

After a successful year of plunder on the high seas, a pirate ship returns to its island base. The pirate chief, who enjoys practical jokes and has a mathematical bent, hands out heavy bags of gold coins to his seven lieutenants. But when the seven lieutenants open the bags, they discover that each of them has received a different number of coins.

They ask the captain why they don’t have equal shares. The pirate chief laughs and tells them to re-distribute the coins according to the following rule: “At each stage, the lieutenant with most coins must give each of his comrades as many coins as that comrade already possesses.”

The lieutenants follow the rule and each one in turn becomes the lieutenant with most coins. When the seventh distribution is over, all seven of them have 128 coins, the coins are fairly distributed, and the rule no longer applies.

The puzzle is this: How did the pirate captain originally allocate the coins to his lieutenants?

If you start at the beginning and work forward, you’ll have to solve a fiendishly complicated set of simultaneous equations. If you start at the end and work backwards, the puzzle will resolve itself almost like magic.

The puzzle is actually about powers of 2, because 128 = 2^7 and when each of six lieutenants receives as many coins as he already has, he doubles his number of coins. Accordingly, before the seventh and final distribution, six of the lieutenants must have had 64 coins and the seventh must have had 128 + 6 * 64 coins = 512 coins.

At the stage before that, five of the lieutenants must have had 32 coins (so that they will have 64 coins after the sixth distribution), one must have had 256 coins (so that he will have 512 coins after the sixth distribution), and one must have had 64 + 5 * 32 + 256 coins = 480 coins. And so on. This is what the solution looks like:

128, 128, 128, 128, 128, 128, 128
512, 64, 64, 64, 64, 64, 64
256, 480, 32, 32, 32, 32, 32
128, 240, 464, 16, 16, 16, 16
64, 120, 232, 456, 8, 8, 8
32, 60, 116, 228, 452, 4, 4
16, 30, 58, 114, 226, 450, 2
8, 15, 29, 57, 113, 225, 449

So the pirate captain must have originally allocated the coins like this: 8, 15, 29, 57, 113, 225, 449 (note how 8 * 2 – 1 = 15, 15 * 2 – 1 = 29, 29 * 2 – 1 = 57…).

The puzzle can be adapted to other powers. Suppose the rule runs like this: “At each stage, the lieutenant with most coins must give each of his comrades twice as many coins as that comrade already possesses.” If the pirate captain has six lieutenants, after each distribution each of five will have n + 2n = three times the number of coins that he previously possessed. The six lieutenants each end up with 729 coins = 3^6 coins and the solution looks like this:

13, 37, 109, 325, 973, 2917
39, 111, 327, 975, 2919, 3
117, 333, 981, 2925, 9, 9
351, 999, 2943, 27, 27, 27
1053, 2997, 81, 81, 81, 81
3159, 243, 243, 243, 243, 243
729, 729, 729, 729, 729, 729

For powers of 4, the rule runs like this: “At each stage, the lieutenant with most coins must give each of his comrades three times as many coins as that comrade already possesses.” With five lieutenants, each of them ends up with 1024 coins = 4^5 coins and the solution looks like this:

16, 61, 241, 961, 3841
64, 244, 964, 3844, 4
256, 976, 3856, 16, 16
1024, 3904, 64, 64, 64
4096, 256, 256, 256, 256
1024, 1024, 1024, 1024, 1024

For powers of 5, the rule runs like this: “At each stage, the lieutenant with most coins must give each of his comrades four times as many coins as that comrade already possesses.” With four lieutenants, each of them ends up with 625 coins = 5^4 coins and the solution looks like this:

17, 81, 401, 2001
85, 405, 2005, 5
425, 2025, 25, 25
2125, 125, 125, 125
625, 625, 625, 625

# Self-Raising Power

The square root of 2 is the number that, raised to the power of 2, equals 2. That is, if r^2 = r * r = 2, then r = √2. The cube root of 2 is the number that, raised to the power of 3, equals 2. That is, if r^3 = r * r * r = 2, then r = [3]√2.

But what do you call the number that, raised to the power of itself, equals 2? I suggest “the auto-root of 2”. Here, if r^r = 2, then r = [r]√2. I don’t know a quick way to calculate the auto-root, but you can adapt a well-known algorithm for approximating the square root of a number. The square-root algorithm looks like this:

n = 2
r = 1
for c = 1 to 20
r = (r + n/r) / 2
next c
print r

r = 1.414213562…

Note the fourth line of the algorithm: r = (r + n/r) / 2. When r is an over-estimate of √2, then 2/r will be an under-estimate (and vice versa). (r + 2/r) / 2 splits the difference and refines the estimate. Using the lines above as the model, the auto-root algorithm looks like this:

n = 2
r = 1
for c = 1 to 20
r = (r + [r]√n) / 2[*]
next c
print r

r = 1.559610469…

*This is equivalent to r = (r + n^(1/r)) / 2

Here are the first 100 digits of [r]√2 = r in base 10:

1, 5, 5, 9, 6, 1, 0, 4, 6, 9, 4, 6, 2, 3, 6, 9, 3, 4, 9, 9, 7, 0, 3, 8, 8, 7, 6, 8, 7, 6, 5, 0, 0, 2, 9, 9, 3, 2, 8, 4, 8, 8, 3, 5, 1, 1, 8, 4, 3, 0, 9, 1, 4, 2, 4, 7, 1, 9, 5, 9, 4, 5, 6, 9, 4, 1, 3, 9, 7, 3, 0, 3, 4, 5, 4, 9, 5, 9, 0, 5, 8, 7, 1, 0, 5, 4, 1, 3, 4, 4, 4, 6, 9, 1, 2, 8, 3, 9, 7, 3…

And here is [r]n = r for n = 2..20:

autopower(2) = 1.5596104694623693499703887…
autopower(3) = 1.8254550229248300400414692…
autopower(4) = 2
autopower(5) = 2.1293724827601566963803119…
autopower(6) = 2.2318286244090093673920215…
autopower(7) = 2.3164549587856123013255030…
autopower(8) = 2.3884234844993385564187215…
autopower(9) = 2.4509539280155796306228059…
autopower(10) = 2.5061841455887692562929409…
autopower(11) = 2.5556046121008206152514542…
autopower(12) = 2.6002950000539155877172082…
autopower(13) = 2.6410619164843958084118390…
autopower(14) = 2.6785234858912995813011990…
autopower(15) = 2.7131636040042392095764012…
autopower(16) = 2.7453680235674634847098492…
autopower(17) = 2.7754491049442334313328329…
autopower(18) = 2.8036632456580215496843618…
autopower(19) = 2.8302234384970308956026277…
autopower(20) = 2.8553085030012414128332189…

I assume that the auto-root is always an irrational number, except when n is a perfect power of suitable form, i.e. n = p^p for some integer p. For example, autoroot(4) = 2, because 2^2 = 4, autoroot(27) = 3, because 3^3 = 27, and so on.

And here is the graph of autoroot(n) for n = 2..10000:

# Power Trip

Here are the first few powers of 2:

2 = 1 * 2
4 = 2 * 2
8 = 4 * 2
16 = 8 * 2
32 = 16 * 2
64 = 32 * 2
128 = 64 * 2
256 = 128 * 2
512 = 256 * 2
1024 = 512 * 2
2048 = 1024 * 2
4096 = 2048 * 2
8192 = 4096 * 2
16384 = 8192 * 2
32768 = 16384 * 2
65536 = 32768 * 2
131072 = 65536 * 2
262144 = 131072 * 2
524288 = 262144 * 2
1048576 = 524288 * 2
2097152 = 1048576 * 2
4194304 = 2097152 * 2
8388608 = 4194304 * 2
16777216 = 8388608 * 2
33554432 = 16777216 * 2
67108864 = 33554432 * 2…

As you can see, it’s a one-way power-trip: the numbers simply get larger. But what happens if you delete the digit 0 whenever it appears in a result? For example, 512 * 2 = 1024, which becomes 124. If you apply this rule, the sequence looks like this:

2 * 2 = 4
4 * 2 = 8
8 * 2 = 16
16 * 2 = 32
32 * 2 = 64
64 * 2 = 128
128 * 2 = 256
256 * 2 = 512
512 * 2 = 1024 → 124
124 * 2 = 248
248 * 2 = 496
496 * 2 = 992
992 * 2 = 1984
1984 * 2 = 3968
3968 * 2 = 7936
7936 * 2 = 15872
15872 * 2 = 31744
31744 * 2 = 63488
63488 * 2 = 126976
126976 * 2 = 253952
253952 * 2 = 507904 → 5794
5794 * 2 = 11588
11588 * 2 = 23176
23176 * 2 = 46352
46352 * 2 = 92704 → 9274…

Is this a power-trip? Not quite: it’s a return trip, because the numbers can never grow beyond a certain size and the sequence falls into a loop. If the result 2n contains a zero, then zerodelete(2n) < n, so the sequence has an upper limit and a number will eventually occur twice. This happens at step 526 with 366784, which matches 366784 at step 490.

The rate at which we delete zeros can obviously be varied. Call it 1:z. The sequence above sets z = 1, so 1:z = 1:1. But what if z = 2, so that 1:z = 1:2? In other words, the procedure deletes every second zero. The first zero occurs when 1024 = 2 * 512, so 1024 is left as it is. The second zero occurs when 2 * 1024 = 2048, so 2048 becomes 248. When z = 2 and every second zero is deleted, the sequence begins like this:

1 * 2 = 2
2 * 2 = 4
4 * 2 = 8
8 * 2 = 16
16 * 2 = 32
32 * 2 = 64
64 * 2 = 128
128 * 2 = 256
256 * 2 = 512
512 * 2 = 1024 → 1024
1024 * 2 = 2048 → 248
248 * 2 = 496
496 * 2 = 992
992 * 2 = 1984
1984 * 2 = 3968
3968 * 2 = 7936
7936 * 2 = 15872
15872 * 2 = 31744
31744 * 2 = 63488
63488 * 2 = 126976
126976 * 2 = 253952
253952 * 2 = 507904 → 50794
50794 * 2 = 101588 → 101588
101588 * 2 = 203176 → 23176
23176 * 2 = 46352
46352 * 2 = 92704 → 92704
92704 * 2 = 185408 → 18548

This sequence also has a ceiling and repeats at step 9134 with 5458864, which matches 5458864 at step 4166. And what about the sequence in which z = 3 and every third zero is deleted? Does this have a ceiling or does the act of multiplying by 2 compensate for the slower removal of zeros?

In fact, it can’t do so. The larger 2n becomes, the more zeros it will tend to contain. If 2n is large enough to contain 3 zeros on average, the deletion of zeros will overpower multiplication by 2 and the sequence will not rise any higher. Therefore the sequence that deletes every third zero will eventually repeat, although I haven’t been able to discover the relevant number.

But this reasoning applies to any rate, 1:z, of zero-deletion. If z = 100 and every hundredth zero is deleted, numbers in the sequence will rise to the point at which 2n contains sufficient zeros on average to counteract multiplication by 2. The sequence will have a ceiling and will eventually repeat. If z = 10^100 or z = 10^(10^100) and every googolth or googolplexth zero is deleted, the same is true. For any rate, 1:z, at which zeros are deleted, the sequence n = zerodelete(2n,z) has an upper limit and will eventually repeat.

Update (30×21)

Six years later, I’ve found the answer for z = 3. And uncovered a serious error in this article. See:

# Will Two Power?

It’s such a simple thing: repeatedly doubling a number: 1, 2, 4, 8, 16, 32, 61, 128… And yet it yields such riches, reminiscent of DNA or a literary text:

2^0 = 1
2^1 = 2
2^2 = 4
2^3 = 8
2^4 = 16
2^5 = 32
2^6 = 64
2^7 = 128
2^8 = 256
2^9 = 512
2^10 = 1024
2^20 = 1048576
2^30 = 1073741824
2^40 = 1099511627776
2^50 = 1125899906842624
2^60 = 1152921504606846976
2^70 = 1180591620717411303424
2^80 = 1208925819614629174706176
2^90 = 1237940039285380274899124224
2^100 = 1267650600228229401496703205376
2^200 = 1606938044258990275541962092341162602522202993782792835301376

Although, by Benford’s law*, 1 is the commonest leading digit, do all numbers eventually appear as the leading digits of some power of 2? I conjecture that they do. indeed, I conjecture that they do infinitely often. If the function first(n) returns the power of 2 whose leading digits are the same as the digits of n, then:

first(1) = 2^0 = 1
first(2) = 2^1 = 2
first(3) = 2^5 = 32
first(4) = 2^2 = 4
first(5) = 2^9 = 512
first(6) = 2^6 = 64
first(7) = 2^46 = 70368744177664
first(8) = 2^3 = 8
first(9) = 2^53 = 9007199254740992
first(10) = 2^10 = 1024

And I conjecture that this is true of all bases except bases that are powers of 2, like 2, 4, 8, 16 and so on. A related question is whether the leading digits of any 2^n are the same as the digits of n. Yes:

2^6 = 64
2^10 = 1024
2^1542 = 1.54259995… * 10^464
2^77075 = 7.70754024… * 10^23201
2^113939 = 1.13939932… * 10^34299
2^1122772 = 1.12277217… * 10^337988

That looks like a look of calculation, but there’s a simple way to cut it down: restrict the leading digits. Eventually they will lose accuracy, because the missing digits are generating carries. With four leading digits, this happens:

1: 0001
2: 0002
4: 0004
8: 0008
16: 0016
32: 0032
64: 0064
128: 0128
256: 0256
512: 0512
1024: 1024
2048: 2048
4096: 4096
8192: 8192
16384: 1638…
32768: 3276…
65536: 6552…

But working with only fifteen leading digits, you can find that 1122772 = the leading digits of 2^1122772, which has 337989 digits when calculated in full.

*Not Zipf’s law, as I originally said.

# Talcum Power

If primes are like diamonds, powers of 2 are like talc. Primes don’t crumble under division, because they can’t be divided by any number but themselves and one. Powers of 2 crumble more than any other numbers. The contrast is particularly strong when the primes are Mersenne primes, or equal to a power of 2 minus 1:

3 = 4-1 = 2^2 – 1.
4, 2, 1.

7 = 8-1 = 2^3 – 1.
8, 4, 2, 1.

31 = 32-1 = 2^5 – 1.
32, 16, 8, 4, 2, 1.

127 = 2^7 – 1.
128, 64, 32, 16, 8, 4, 2, 1.

8191 = 2^13 – 1.
8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1.

131071 = 2^17 – 1.
131072, 65536, 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1.

524287 = 2^19 – 1.
524288, 262144, 131072, 65536, 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1.

2147483647 = 2^31 – 1.
2147483648, 1073741824, 536870912, 268435456, 134217728, 67108864, 33554432, 16777216, 8388608, 4194304, 2097152, 1048576, 524288, 262144, 131072, 65536, 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1.

Are Mersenne primes infinite? If they are, then there will be just as many Mersenne primes as powers of 2, even though very few powers of 2 create a Mersenne prime. That’s one of the paradoxes of infinity: an infinite part is equal to an infinite whole.

But are they infinite? No-one knows, though some of the greatest mathematicians in history have tried to find a proof or disproof of the conjecture. A simpler question about powers of 2 is this: Does every integer appear as part of a power of 2? I can’t find one that doesn’t:

0 is in 1024 = 2^10.
1 is in 16 = 2^4.
2 is in 32 = 2^5.
3 is in 32 = 2^5.
4 = 2^2.
5 is in 256 = 2^8.
6 is in 16 = 2^4.
7 is in 32768 = 2^15.
8 = 2^3.
9 is in 4096 = 2^12.
10 is in 1024 = 2^10.
11 is in 1099511627776 = 2^40.
12 is in 128 = 2^7.
13 is in 131072 = 2^17.
14 is in 262144 = 2^18.
15 is in 2097152 = 2^21.
16 = 2^4.
17 is in 134217728 = 2^27.
18 is in 1073741824 = 2^30.
19 is in 8192 = 2^13.
20 is in 2048 = 2^11.

666 is in 182687704666362864775460604089535377456991567872 = 2^157.
1066 is in 43556142965880123323311949751266331066368 = 2^135.
1492 is in 356811923176489970264571492362373784095686656 = 2^148.
2014 is in 3705346855594118253554271520278013051304639509300498049262642688253220148477952 = 2^261.

I’ve tested much higher than that, but testing is no good: where’s a proof? I don’t have one, though I conjecture that all integers do appear as part or whole of a power of 2. Nor do I have a proof for another conjecture: that all integers appear infinitely often as part or whole of powers of 2. Or indeed, of powers of 3, 4, 5 or any other number except powers of 10.

I conjecture that this would apply in all bases too: In any base b all n appear infinitely often as part or whole of powers of any number except those equal to a power of b.

1 is in 11 = 2^2 in base 3.
2 is in 22 = 2^3 in base 3.
10 is in 1012 = 2^5 in base 3.
11 = 2^2 in base 3.
12 is in 121 = 2^4 in base 3.
20 is in 11202 = 2^7 in base 3.
21 is in 121 = 2^4 in base 3.
22 = 2^3 in base 3.
100 is in 100111 = 2^8 in base 3.
101 is in 1012 = 2^5 in base 3.
102 is in 2210212 = 2^11 in base 3.
110 is in 1101221 = 2^10 in base 3.
111 is in 100111 = 2^8 in base 3.
112 is in 11202 = 2^7 in base 3.
120 is in 11202 = 2^7 in base 3.
121 = 2^4 in base 3.
122 is in 1101221 = 2^10 in base 3.
200 is in 200222 = 2^9 in base 3.
201 is in 12121201 = 2^12 in base 3.
202 is in 11202 = 2^7 in base 3.

1 is in 13 = 2^3 in base 5.
2 is in 112 = 2^5 in base 5.
3 is in 13 = 2^3 in base 5.
4 = 2^2 in base 5.
10 is in 1003 = 2^7 in base 5.
11 is in 112 = 2^5 in base 5.
12 is in 112 = 2^5 in base 5.
13 = 2^3 in base 5.
14 is in 31143 = 2^11 in base 5.
20 is in 2011 = 2^8 in base 5.
21 is in 4044121 = 2^16 in base 5.
22 is in 224 = 2^6 in base 5.
23 is in 112341 = 2^12 in base 5.
24 is in 224 = 2^6 in base 5.
30 is in 13044 = 2^10 in base 5.
31 = 2^4 in base 5.
32 is in 230232 = 2^13 in base 5.
33 is in 2022033 = 2^15 in base 5.
34 is in 112341 = 2^12 in base 5.
40 is in 4022 = 2^9 in base 5.

1 is in 12 = 2^3 in base 6.
2 is in 12 = 2^3 in base 6.
3 is in 332 = 2^7 in base 6.
4 = 2^2 in base 6.
5 is in 52 = 2^5 in base 6.
10 is in 1104 = 2^8 in base 6.
11 is in 1104 = 2^8 in base 6.
12 = 2^3 in base 6.
13 is in 13252 = 2^11 in base 6.
14 is in 144 = 2^6 in base 6.
15 is in 101532 = 2^13 in base 6.
20 is in 203504 = 2^14 in base 6.
21 is in 2212 = 2^9 in base 6.
22 is in 2212 = 2^9 in base 6.
23 is in 1223224 = 2^16 in base 6.
24 = 2^4 in base 6.
25 is in 13252 = 2^11 in base 6.
30 is in 30544 = 2^12 in base 6.
31 is in 15123132 = 2^19 in base 6.
32 is in 332 = 2^7 in base 6.

1 is in 11 = 2^3 in base 7.
2 is in 22 = 2^4 in base 7.
3 is in 1331 = 2^9 in base 7.
4 = 2^2 in base 7.
5 is in 514 = 2^8 in base 7.
6 is in 2662 = 2^10 in base 7.
10 is in 1054064 = 2^17 in base 7.
11 = 2^3 in base 7.
12 is in 121 = 2^6 in base 7.
13 is in 1331 = 2^9 in base 7.
14 is in 514 = 2^8 in base 7.
15 is in 35415440431 = 2^30 in base 7.
16 is in 164351 = 2^15 in base 7.
20 is in 362032 = 2^16 in base 7.
21 is in 121 = 2^6 in base 7.
22 = 2^4 in base 7.
23 is in 4312352 = 2^19 in base 7.
24 is in 242 = 2^7 in base 7.
25 is in 11625034 = 2^20 in base 7.
26 is in 2662 = 2^10 in base 7.

1 is in 17 = 2^4 in base 9.
2 is in 152 = 2^7 in base 9.
3 is in 35 = 2^5 in base 9.
4 = 2^2 in base 9.
5 is in 35 = 2^5 in base 9.
6 is in 628 = 2^9 in base 9.
7 is in 17 = 2^4 in base 9.
8 = 2^3 in base 9.
10 is in 108807 = 2^16 in base 9.
11 is in 34511011 = 2^24 in base 9.
12 is in 12212 = 2^13 in base 9.
13 is in 1357 = 2^10 in base 9.
14 is in 314 = 2^8 in base 9.
15 is in 152 = 2^7 in base 9.
16 is in 878162 = 2^19 in base 9.
17 = 2^4 in base 9.
18 is in 218715 = 2^17 in base 9.
20 is in 70122022 = 2^25 in base 9.
21 is in 12212 = 2^13 in base 9.
22 is in 12212 = 2^13 in base 9.

# DeVil to Power

666 is the Number of the Beast described in the Book of Revelation:

13:18 Here is wisdom. Let him that hath understanding count the number of the beast: for it is the number of a man; and his number is Six hundred threescore and six.

But 666 is not just diabolic: it’s narcissistic too. That is, it mirrors itself using arithmetic, like this:

666^47 =

5,049,969,684,420,796,753,173,148,798,405,
564,772,941,516,295,265,408,188,117,632,
668,936,540,446,616,033,068,653,028,889,
892,718,859,670,297,563,286,219,594,665,
904,733,945,856 → 5 + 0 + 4 + 9 + 9 + 6 + 9 + 6 + 8 + 4 + 4 + 2 + 0 + 7 + 9 + 6 + 7 + 5 + 3 + 1 + 7 + 3 + 1 + 4 + 8 + 7 + 9 + 8 + 4 + 0 + 5 + 5 + 6 + 4 + 7 + 7 + 2 + 9 + 4 + 1 + 5 + 1 + 6 + 2 + 9 + 5 + 2 + 6 + 5 + 4 + 0 + 8 + 1 + 8 + 8 + 1 + 1 + 7 + 6 + 3 + 2 + 6 + 6 + 8 + 9 + 3 + 6 + 5 + 4 + 0 + 4 + 4 + 6 + 6 + 1 + 6 + 0 + 3 + 3 + 0 + 6 + 8 + 6 + 5 + 3 + 0 + 2 + 8 + 8 + 8 + 9 + 8 + 9 + 2 + 7 + 1 + 8 + 8 + 5 + 9 + 6 + 7 + 0 + 2 + 9 + 7 + 5 + 6 + 3 + 2 + 8 + 6 + 2 + 1 + 9 + 5 + 9 + 4 + 6 + 6 + 5 + 9 + 0 + 4 + 7 + 3 + 3 + 9 + 4 + 5 + 8 + 5 + 6 = 666

666^51 =

993,540,757,591,385,940,334,263,511,341,
295,980,723,858,637,469,431,008,997,120,
691,313,460,713,282,967,582,530,234,558,
214,918,480,960,748,972,838,900,637,634,
215,694,097,683,599,029,436,416 → 9 + 9 + 3 + 5 + 4 + 0 + 7 + 5 + 7 + 5 + 9 + 1 + 3 + 8 + 5 + 9 + 4 + 0 + 3 + 3 + 4 + 2 + 6 + 3 + 5 + 1 + 1 + 3 + 4 + 1 + 2 + 9 + 5 + 9 + 8 + 0 + 7 + 2 + 3 + 8 + 5 + 8 + 6 + 3 + 7 + 4 + 6 + 9 + 4 + 3 + 1 + 0 + 0 + 8 + 9 + 9 + 7 + 1 + 2 + 0 + 6 + 9 + 1 + 3 + 1 + 3 + 4 + 6 + 0 + 7 + 1 + 3 + 2 + 8 + 2 + 9 + 6 + 7 + 5 + 8 + 2 + 5 + 3 + 0 + 2 + 3 + 4 + 5 + 5 + 8 + 2 + 1 + 4 + 9 + 1 + 8 + 4 + 8 + 0 + 9 + 6 + 0 + 7 + 4 + 8 + 9 + 7 + 2 + 8 + 3 + 8 + 9 + 0 + 0 + 6 + 3 + 7 + 6 + 3 + 4 + 2 + 1 + 5 + 6 + 9 + 4 + 0 + 9 + 7 + 6 + 8 + 3 + 5 + 9 + 9 + 0 + 2 + 9 + 4 + 3 + 6 + 4 + 1 + 6 = 666

But those are tiny numbers compared to 6^(6^6). That means 6^46,656 and equals roughly 2·6591… x 10^36,305. It’s 36,306 digits long and its full digit-sum is 162,828. However, 666 lies concealed in those digits too. To see how, consider the function Σ(x1,xn), which returns the sum of digits 1 to n of x. For example, π = 3·14159265…, so Σ(π14) = 3 + 1 + 4 + 1 = 9. The first 150 digits of 6^(6^6) are these:

26591197721532267796824894043879185949053422002699
24300660432789497073559873882909121342292906175583
03244068282650672342560163577559027938964261261109
… (150 digits)

If x = 6^(6^6), then Σ(x1,x146) = 666, Σ(x2,x148) = 666, and Σ(x2,x149) = 666.

There’s nothing special about these patterns: infinitely many numbers are narcissistic in similar ways. However, 666 has a special cultural significance, so people pay it more attention and look for patterns related to it more carefully. Who cares, for example, that 667 = digit-sum(667^48) = digit-sum(667^54) = digit-sum(667^58)? Fans of recreational maths will, but not very much. The Number of the Beast is much more fun, narcissistically and otherwise:

666 = digit-sum(6^194)
666 = digit-sum(6^197)

666 = digit-sum(111^73)
666 = digit-sum(111^80)

666 = digit-sum(222^63)
666 = digit-sum(222^66)

666 = digit-sum(333^58)
666 = digit-sum(444^53)
666 = digit-sum(777^49)
666 = digit-sum(999^49)