# Fib and Let Tri

It’s a simple sequence with hidden depths:

1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155... — A000045 at OEIS

That’s the Fibonacci sequence, probably the most famous of all integer sequences after the integers themselves (1, 2, 3, 4, 5…) and the primes (2, 3, 5, 7, 11…). It has a very simple definition: if fib(fi) is the fi-th number in the Fibonacci sequence, then fib(fi) = fib(fi-1) + fib(fi-2). By definition, fib(1) = fib(2) = 1. After that, it’s easy to generate new numbers:

2 = fib(3) = fib(1) + fib(2) = 1 + 1
3 = fib(4) = fib(2) + fib(3) = 1 + 2
5 = fib(5) = fib(3) + fib(4) = 2 + 3
8 = fib(6) = fib(4) + fib(5) = 3 + 5
13 = fib(7) = fib(5) + fib(6) = 5 + 8
21 = fib(8) = fib(6) + fib(7) = 8 + 13
34 = fib(9) = fib(7) + fib(8) = 13 + 21
55 = fib(10) = fib(8) + fib(9) = 21 + 34
89 = fib(11) = fib(9) + fib(10) = 34 + 55
144 = fib(12) = fib(10) + fib(11) = 55 + 89
233 = fib(13) = fib(11) + fib(12) = 89 + 144
377 = fib(14) = fib(12) + fib(13) = 144 + 233
610 = fib(15) = fib(13) + fib(14) = 233 + 377
987 = fib(16) = fib(14) + fib(15) = 377 + 610
[...]

How to create the Fibonacci sequence is obvious. But it’s not obvious that fib(fi) / fib(fi-1) gives you ever-better approximations to a fascinating constant called φ, the golden ratio, which is 1.618033988749894…:

1/1 = 1
2/1 = 2
3/2 = 1.5
5/3 = 1.66666...
8/5 = 1.6
13/8 = 1.625
21/13 = 1.615384...
34/21 = 1.619047...
55/34 = 1.6176470588235294117647058823...
89/55 = 1.618181818...
144/89 = 1.617977528089887640...
233/144 = 1.6180555555...
377/233 = 1.618025751072961...
610/377 = 1.618037135278514...
987/610 = 1.618032786885245...
[...]

And that’s just the start of the hidden depths in the Fibonacci sequence. I stumbled across another interesting pattern for myself a few days ago. I was looking at the sequence and one of the numbers caught my eye:

1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597...

55 is a palindrome, reading the same forward and backwards. I wondered whether there were any other palindromes in the sequence (apart from the trivial single-digit palindromes 1, 1, 2, 3…). I couldn’t find any more. Nor can anyone else, apparently. But that’s in base 10. Other bases are more productive. For example, in bases 2, 3 and 4, you get this:

11 in b2 = 3
101 in b2 = 5
10101 in b2 = 21

22 in b3 = 8
111 in b3 = 13
22122 in b3 = 233

11 in b4 = 5
111 in b4 = 21
202 in b4 = 34
313 in b4 = 55

I decided to concentrate on tripals, or palindromes with three digits. I started looking at bases that set records for the greatest number of tripals. And there are some interesting patterns in the digits of the tripals in these bases (when a digit > 9, the digit is represented inside square brackets — see base-29 and higher). See how quickly you can spot the patterns:

Palindromic Fibonacci numbers in base-4

111 in b4 (fib=21, fi=8)
202 in b4 (fib=34, fi=9)
313 in b4 (fib=55, fi=10)

4 = 2^2 (pal=3)

Palindromic Fibonacci numbers in base-11

121 in b11 (fib=144, fi=12)
313 in b11 (fib=377, fi=14)
505 in b11 (fib=610, fi=15)
818 in b11 (fib=987, fi=16)

11 is prime (pal=4)

Palindromic Fibonacci numbers in base-29

151 in b29 (fib=987, fi=16)
323 in b29 (fib=2584, fi=18)
818 in b29 (fib=6765, fi=20)
[13]0[13] in b29 (fib=10946, fi=21)
[21]1[21] in b29 (fib=17711, fi=22)

29 is prime (pal=5)

Palindromic Fibonacci numbers in base-76

1[13]1 in b76 (fib=6765, fi=20)
353 in b76 (fib=17711, fi=22)
828 in b76 (fib=46368, fi=24)
[21]1[21] in b76 (fib=121393, fi=26)
[34]0[34] in b76 (fib=196418, fi=27)
[55]1[55] in b76 (fib=317811, fi=28)

76 = 2^2 * 19 (pal=6)

Palindromic Fibonacci numbers in base-199

1[34]1 in b199 (fib=46368, fi=24)
3[13]3 in b199 (fib=121393, fi=26)
858 in b199 (fib=317811, fi=28)
[21]2[21] in b199 (fib=832040, fi=30)
[55]1[55] in b199 (fib=2178309, fi=32)
[89]0[89] in b199 (fib=3524578, fi=33)
[144]1[144] in b199 (fib=5702887, fi=34)

199 is prime (pal=7)

Palindromic Fibonacci numbers in base-521

1[89]1 in b521 (fib=317811, fi=28)
3[34]3 in b521 (fib=832040, fi=30)
8[13]8 in b521 (fib=2178309, fi=32)
[21]5[21] in b521 (fib=5702887, fi=34)
[55]2[55] in b521 (fib=14930352, fi=36)
[144]1[144] in b521 (fib=39088169, fi=38)
[233]0[233] in b521 (fib=63245986, fi=39)
[377]1[377] in b521 (fib=102334155, fi=40)

521 is prime (pal=8)

Palindromic Fibonacci numbers in base-1364

1[233]1 in b1364 (fib=2178309, fi=32)
3[89]3 in b1364 (fib=5702887, fi=34)
8[34]8 in b1364 (fib=14930352, fi=36)
[21][13][21] in b1364 (fib=39088169, fi=38)
[55]5[55] in b1364 (fib=102334155, fi=40)
[144]2[144] in b1364 (fib=267914296, fi=42)
[377]1[377] in b1364 (fib=701408733, fi=44)
[610]0[610] in b1364 (fib=1134903170, fi=45)
[987]1[987] in b1364 (fib=1836311903, fi=46)

1364 = 2^2 * 11 * 31 (pal=9)

Two patterns are quickly obvious. Every digit in the tripals is a Fibonacci number. And the middle digit of one Fibonacci tripal, fib(fi), becomes fib(fi-2) in the next tripal, while fib(fi), the first and last digits (which are identical), becomes fib(fi+2) in the next tripal.

But what about the bases? If you’re an expert in the Fibonacci sequence, you’ll spot the pattern at work straight away. I’m not an expert, but I spotted it in the end. Here are the first few bases setting records for the numbers of Fibonacci tripals:

4, 11, 29, 76, 199, 521, 1364, 3571, 9349, 24476, 64079, 167761, 439204, 1149851, 3010349, 7881196...

These numbers come from the Lucas sequence, which is closely related to the Fibonacci sequence. But where fib(1) = fib(2) = 1, luc(1) = 1 and luc(2) = 3. After that, luc(li) = luc(li-2) + luc(li-1):

1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322, 521, 843, 1364, 2207, 3571, 5778, 9349, 15127, 24476, 39603, 64079, 103682, 167761, 271443, 439204, 710647, 1149851, 1860498, 3010349, 4870847, 7881196... — A000204 at OEIS

It seems that every second number from 4 in the Lucas sequence supplies a base in which 1) the number of Fibonacci tripals sets a new record; 2) every digit of the Fibonacci tripals is itself a Fibonacci number.

But can I prove that this is always true? No. And do I understand why these patterns exist? No. My simple search for palindromes in the Fibonacci sequence soon took me far out of my mathematical depth. But it’s been fun to find huge bases like this in which every digit of every Fibonacci tripal is itself a Fibonacci number:

Palindromic Fibonacci numbers in base-817138163596

1[139583862445]1 in b817138163596 (fib=781774079430987230203437, fi=116)
3[53316291173]3 in b817138163596 (fib=2046711111473984623691759, fi=118)
8[20365011074]8 in b817138163596 (fib=5358359254990966640871840, fi=120)
[21][7778742049][21] in b817138163596 (fib=14028366653498915298923761, fi=122)
[55][2971215073][55] in b817138163596 (fib=36726740705505779255899443, fi=124)
[144][1134903170][144] in b817138163596 (fib=96151855463018422468774568, fi=126)
[377][433494437][377] in b817138163596 (fib=251728825683549488150424261, fi=128)
[987][165580141][987] in b817138163596 (fib=659034621587630041982498215, fi=130)
[2584][63245986][2584] in b817138163596 (fib=1725375039079340637797070384, fi=132)
[6765][24157817][6765] in b817138163596 (fib=4517090495650391871408712937, fi=134)
[17711][9227465][17711] in b817138163596 (fib=11825896447871834976429068427, fi=136)
[46368][3524578][46368] in b817138163596 (fib=30960598847965113057878492344, fi=138)
[121393][1346269][121393] in b817138163596 (fib=81055900096023504197206408605, fi=140)
[317811][514229][317811] in b817138163596 (fib=212207101440105399533740733471, fi=142)
[832040][196418][832040] in b817138163596 (fib=555565404224292694404015791808, fi=144)
[2178309][75025][2178309] in b817138163596 (fib=1454489111232772683678306641953, fi=146)
[5702887][28657][5702887] in b817138163596 (fib=3807901929474025356630904134051, fi=148)
[14930352][10946][14930352] in b817138163596 (fib=9969216677189303386214405760200, fi=150)
[39088169][4181][39088169] in b817138163596 (fib=26099748102093884802012313146549, fi=152)
[102334155][1597][102334155] in b817138163596 (fib=68330027629092351019822533679447, fi=154)
[267914296][610][267914296] in b817138163596 (fib=178890334785183168257455287891792, fi=156)
[701408733][233][701408733] in b817138163596 (fib=468340976726457153752543329995929, fi=158)
[1836311903][89][1836311903] in b817138163596 (fib=1226132595394188293000174702095995, fi=160)
[4807526976][34][4807526976] in b817138163596 (fib=3210056809456107725247980776292056, fi=162)
[12586269025][13][12586269025] in b817138163596 (fib=8404037832974134882743767626780173, fi=164)
[32951280099]5[32951280099] in b817138163596 (fib=22002056689466296922983322104048463, fi=166)
[86267571272]2[86267571272] in b817138163596 (fib=57602132235424755886206198685365216, fi=168)
[225851433717]1[225851433717] in b817138163596 (fib=150804340016807970735635273952047185, fi=170)
[365435296162]0[365435296162] in b817138163596 (fib=244006547798191185585064349218729154, fi=171)
[591286729879]1[591286729879] in b817138163596 (fib=394810887814999156320699623170776339, fi=172)

817138163596 = 2^2 * 229 * 9349 * 95419 (pal=30)

# RevNumSum

If you take an integer, n, and reverse its digits to get the integer r, there are three possibilities:

n > r (e.g. 85236 > 63258)
n < r (e.g. 17783 < 38771)
n = r (e.g. 45154 = 45154)

If n = r, n is a palindrome. If n > r, I call n a major number. If n < r, I call n a minor number. And here are the minor and major numbers represented as white squares on an Ulam-like spiral (the negative of a minor spiral is a major spiral, and vice versa — sometimes one looks better than the other):

b=2 (minor numbers)

b=3

b=4

b=5

b=6

b=7 (major numbers)

b=8 (minor numbers)

b=9 (mjn)

b=10 (mjn)

b=11 (mjn)

b=12 (mjn)

b=13 (mjn)

b=14 (mjn)

b=15 (mjn)

b=16 (mjn)

b=17 (mjn)

b=18 (mjn)

b=19 (mjn)

b=20 (mjn)

Minor numbers, b=2..20 (animated)

Now let’s look at a sequence formed by summing the reversed numbers, minor ones, major ones and palindromes. Here are the standard integers:

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17...

If you sum the integers, you get what are called the triangular numbers:

1 = 1
3 = 1 + 2
6 = 1 + 2 + 3
10 = 1 + 2 + 3 + 4
15 = 1 + 2 + 3 + 4 + 5
21 = 1 + 2 + 3 + 4 + 5 + 6
28 = 1 + 2 + 3 + 4 + 5 + 6 + 7
36 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8
45 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9
55 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10
66 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11
78 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12
91 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13
105 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14
120 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15
136 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16
153 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17
171 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18
190 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19
210 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20

But what happens if you reverse the integers before summing them? Here side-by-side are the triangular numbers and the underlined revnumsums (as they might be called):

45 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9
45 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9
55 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10
46 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1
66 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11
57 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 11
78 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12
78 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 11 + 21
91 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13
109 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 11 + 21 + 31
105 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14
150 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 11 + 21 + 31 + 41
120 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15
201 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 11 + 21 + 31 + 41 + 51
136 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16
262 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 11 + 21 + 31 + 41 + 51 + 61
153 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17
333 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 11 + 21 + 31 + 41 + 51 + 61 + 71
171 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18
414 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 11 + 21 + 31 + 41 + 51 + 61 + 71 + 81
190 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19
505 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 11 + 21 + 31 + 41 + 51 + 61 + 71 + 81 + 91
210 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20
507 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 11 + 21 + 31 + 41 + 51 + 61 + 71 + 81 + 91
+ 2

Unlike triangular numbers, revnumsums are dependent on the base they’re calculated in. In base 2, the revnumsum is always smaller than the triangular number, except at step 1. In base 3, the revnumsum is equal to the triangular number at steps 1, 2 and 15 (= 120 in base 3). Otherwise it’s smaller than the triangular number.

And in higher bases? In bases > 3, the revnumsum rises and falls above the equivalent triangular number. When it’s higher, it tends towards a maximum height of (base+1)/4 * triangular number.

# An N-Finity

10111 in base 2
212 in base 3
113 in base 4
43 in base 5
35 in base 6
32 in base 7
27 in base 8
25 in base 9
23 in base 10
21 in base 11
1B in base 12
1A in base 13
19 in base 14
18 in base 15
17 in base 16
16 in base 17
15 in base 18
14 in base 19
13 in base 20
12 in base 21
11 in base 22
10 in base 23
N in all bases >= 24

√23 = 4.79583152331…

# Zequality Now

Here are the numbers one to eight in base 2:

1, 10, 11, 100, 101, 110, 111, 1000…

Now see what happens when you count the zeroes:

1, 10[1], 11, 10[2]0[3], 10[4]1, 110[5], 111, 10[6]0[7]0[8]...

In base 2, the numbers one to eight contain exactly eight zeroes, that is, zerocount(1..8,b=2) = 8. But it doesn’t work out so exactly in base 3:

1, 2, 10[1], 11, 12, 20[2], 21, 22, 10[3]0[4], 10[5]1, 10[6]2, 110[7], 111, 112, 120[8], 121, 122, 20[9]0[10], 20[11]1, 20[12]2, 210[13], 211, 212, 220[14], 221, 222, 10[15]0[16]0[17], 10[18]0[19]1, 10[20]0[21]2, 10[22]10[23], 10[24]11, 10[25]12, 10[26]20[27], 10[28]21, 10[29]22, 110[30]0[31], 110[32]1, 110[33]2, 1110[34], 1111, 1112, 1120[35], 1121, 1122, 120[36]0[37], 120[38]1, 120[39]2, 1210[40], 1211, 1212, 1220[41], 1221, 1222, 20[42]0[43]0[44], 20[45]0[46]1, 20[47]0[48]2, 20[49]10[50], 20[51]11, 20[52]12, 20[53]20[54], 20[55]21, 20[56]22, 210[57]0[58], 210[59]1, 210[60]2, 2110[61], 2111, 2112, 2120[62], 2121, 2122, 220[63]0[64], 220[65]1, 220[66]2, 2210[67], 2211, 2212, 2220[68], 2221, 2222, 10[69]0[70]0[71]0[72], 10[73]0[74]0[75]1, 10[76]0[77]0[78]2, 10[79]0[80]10[81], 10[82]0[83]11, 10[84]0[85]12, 10[86]0[87]20[88]...

In base 3, 10020 = 87 and zerocount(1..87,b=3) = 88. And what about base 4? zerocount(1..1068,b=4) = 1069 (n=100,230 in base 4). After that, zerocount(1..16022,b=5) = 16023 (n=1,003,043 in base 5) and zerocount(1..284704,b=6) = 284,705 (n=10,034,024 in base 6).

The numbers are getting bigger fast and it’s becoming increasingly impractible to count the zeroes individually. What you need is an algorithm that will take any given n and work out how many zeroes are required to write the numbers 1 to n. The simplest way to do this is to work out how many times 0 has appeared in each position of the number. The 1s position is easy: you simply divide the number by the base and discard the remainder. For example, in base 10, take the number 25. The 0 must have appeared in the 1s position twice, for 10 and 20, so zerocount(1..25) = 25 \ 10 = 2. In 2017, the 0 must have appeared in the 1s position 201 times = 2017 \ 10. And so on.

It gets a little trickier for the higher positions, the 10s, 100s, 1000s and so on, but the same basic principle applies. And so you can easily create an algorithm that takes a number, n, and produces zerocount(1..n) in a particular base. With this algorithm, you can quickly find zerocount(1..n) >= n in higher bases:

zerocount(1..1000,b=2) = 1,000 (n=8)*
zerocount(1..10020,b=3) = 10,021 (n=87)
zerocount(1..100230,b=4) = 100,231 (n=1,068)
zerocount(1..1003042,b=5) = 1,003,043 (n=16,022)
zerocount(1..10034024,b=6) = 10,034,025 (n=284,704)
zerocount(1..100405550,b=7) = 100,405,551 (n=5,834,024)
zerocount(1..1004500236,b=8) = 1,004,500,237 (n=135,430,302)
zerocount(1..10050705366,b=9) = 10,050,705,367 (n=3,511,116,537)
zerocount(1..100559404366,b=10) = 100,559,404,367
zerocount(1..1006083A68919,b=11) = 1,006,083,A68,919 (n=3,152,738,985,031)*
zerocount(1..10066AA1430568,b=12) = 10,066,AA1,430,569 (n=107,400,330,425,888)
zerocount(1..1007098A8719B81,b=13) = 100,709,8A8,719,B81 (n=3,950,024,143,546,664)*
zerocount(1..10077C39805D81C7,b=14) = 1,007,7C3,980,5D8,1C8 (n=155,996,847,068,247,395)
zerocount(1..10080B0034AA5D16D,b=15) = 10,080,B00,34A,A5D,171 (n=6,584,073,072,068,125,453)
zerocount(1..10088DBE29597A6C77,b=16) = 100,88D,BE2,959,7A6,C77 (n=295,764,262,988,176,583,799)*
zerocount(1..10090C5309AG72CBB3F,b=17) = 1,009,0C5,309,AG7,2CB,B3G (n=14,088,968,131,538,370,019,982)
zerocount(1..10099F39070FC73C1G73,b=18) = 10,099,F39,070,FC7,3C1,G75 (n=709,394,716,006,812,244,474,473)
zerocount(1..100A0DC1258614CA334EB,b=19) = 100,A0D,C12,586,14C,A33,4EC (n=37,644,984,315,968,494,382,106,708)
zerocount(1..100AAGDEEB536IBHE87006,b=20) = 1,00A,AGD,EEB,536,IBH,E87,008 (n=2,099,915,447,874,594,268,014,136,006)

And you can also easily find the zequal numbers, that is, the numbers n for which, in some base, zerocount(1..n) exactly equals n:

zerocount(1..1000,b=2) = 1,000 (n=8)
zerocount(1..1006083A68919,b=11) = 1,006,083,A68,919 (n=3,152,738,985,031)
zerocount(1..1007098A8719B81,b=13) = 100,709,8A8,719,B81 (n=3,950,024,143,546,664)
zerocount(1..10088DBE29597A6C77,b=16) = 100,88D,BE2,959,7A6,C77 (n=295,764,262,988,176,583,799)
zerocount(1..100DDL38CIO4P9K0AJ7HK74EMI7L,b=26) = 1,00D,DL3,8CI,O4P,9K0,AJ7,HK7,4EM,I7L (n=160,182,333,966,853,031,081,693,091,544,779,177,187)
zerocount(1..100EEMHG6OE8EQKO0BF17LCCIA7GPE,b=28) = 100,EEM,HG6,OE8,EQK,O0B,F17,LCC,IA7,GPE (n=928,688,890,453,756,699,447,122,559,347,771,300,777,482)
zerocount(1..100F0K7MQO6K9R1S616IEEL2JRI73PF,b=29) = 1,00F,0K7,MQO,6K9,R1S,616,IEE,L2J,RI7,3PF (n=74,508,769,042,363,852,559,476,397,161,338,769,391,145,562)
zerocount(1..100G0LIL0OQLF2O0KIFTK1Q4DC24HL7BR,b=31) = 100,G0L,IL0,OQL,F2O,0KI,FTK,1Q4,DC2,4HL,7BR (n=529,428,987,529,739,460,369,842,168,744,635,422,842,585,510,266)
zerocount(1..100H0MUTQU3A0I5005WL2PD7T1ASW7IV7NE,b=33) = 10,0H0,MUT,QU3,A0I,500,5WL,2PD,7T1,ASW,7IV,7NE (n=4,262,649,311,868,962,034,947,877,223,846,561,239,424,294,726,563,632)
zerocount(1..100HHR387RQHK9OP6EDBJEUDAK35N7MN96LB,b=34) = 100,HHR,387,RQH,K9O,P6E,DBJ,EUD,AK3,5N7,MN9,6LB (n=399,903,937,958,473,433,782,862,763,628,747,974,628,490,691,628,136,485)
zerocount(1..100IISLI0CYX2893G9E8T4I7JHKTV41U0BKRHT,b=36) = 10,0II,SLI,0CY,X28,93G,9E8,T4I,7JH,KTV,41U,0BK,RHT (n=3,831,465,379,323,568,772,890,827,210,355,149,992,132,716,389,119,437,755,185)
zerocount(1..100LLX383BPWE[40]ZL0G1M[40]1OX[39]67KOPUD5C[40]RGQ5S6W9[36],b=42) = 10,0LL,X38,3BP,WE[40],ZL0,G1M,[40]1O,X[39]6,7KO,PUD,5C[40],RGQ,5S6,W9[36] (n=6,307,330,799,917,244,669,565,360,008,241,590,852,337,124,982,231,464,556,869,653,913,711,854)
zerocount(1..100MMYPJ[38]14KDV[37]OG[39]4[42]X75BE[39][39]4[43]CK[39]K36H[41]M[37][43]5HIWNJ,b=44) = 1,00M,MYP,J[38]1,4KD,V[37]O,G[39]4,[42]X7,5BE,[39][39]4,[43]CK,[39]K3,6H[41],M[37][43],5HI,WNJ (n=90,257,901,046,284,988,692,468,444,260,851,559,856,553,889,199,511,017,124,021,440,877,333,751,943)
zerocount(1..100NN[36]3813[38][37]16F6MWV[41]UBNF5FQ48N0JRN[40]E76ZOHUNX2[42]3[43],b=46) = 100,NN[36],381,3[38][37],16F,6MW,V[41]U,BNF,5FQ,48N,0JR,N[40]E,76Z,OHU,NX2,[42]3[43] (n=1,411,636,908,622,223,745,851,790,772,948,051,467,006,489,552,352,013,745,000,752,115,904,961,213,172,605)
zerocount(1..100O0WBZO9PU6O29TM8Y0QE3I[37][39]A7E4YN[44][42]70[44]I[46]Z[45][37]Q2WYI6,b=47) = 1,00O,0WB,ZO9,PU6,O29,TM8,Y0Q,E3I,[37][39]A,7E4,YN[44],[42]70,[44]I[46],Z[45][37],Q2W,YI6 (n=182,304,598,281,321,725,937,412,348,242,305,189,665,300,088,639,063,301,010,710,450,793,661,266,208,306,996)
zerocount(1..100PP[39]37[49]NIYMN[43]YFE[44]TDTJ00EAEIP0BIDFAK[46][36]V6V[45]M[42]1M[46]SSZ[40],b=50) = 1,00P,P[39]3,7[49]N,IYM,N[43]Y,FE[44],TDT,J00,EAE,IP0,BID,FAK,[46][36]V,6V[45],M[42]1,M[46]S,SZ[40] (n=444,179,859,561,011,965,929,496,863,186,893,220,413,478,345,535,397,637,990,204,496,296,663,272,376,585,291,071,790)
zerocount(1..100Q0Y[46][44]K[49]CKG[45]A[47]Z[43]SPZKGVRN[37]2[41]ZPP[36]I[49][37]EZ[38]C[44]E[46]00CG[38][40][48]ROV,b=51) = 10,0Q0,Y[46][44],K[49]C,KG[45],A[47]Z,[43]SP,ZKG,VRN,[37]2[41],ZPP,[36]I[49],[37]EZ,[38]C[44],E[46]0,0CG,[38][40][48],ROV (n=62,191,970,278,446,971,531,566,522,791,454,395,351,613,891,150,548,291,266,262,575,754,206,359,828,753,062,692,619,547)
zerocount(1..100QQ[40]TL[39]ZA[49][41]J[41]7Q[46]4[41]66A1E6QHHTM9[44]8Z892FRUL6V[46]1[38][41]C[40][45]KB[39],b=52) = 100,QQ[40],TL[39],ZA[49],41]J[41],7Q[46],4[41]6,6A1,E6Q,HHT,M9[44],8Z8,92F,RUL,6V[46],1[38][41],C[40][45],KB[39] (n=8,876,854,501,927,007,077,802,489,292,131,402,136,556,544,697,945,824,257,389,527,114,587,644,068,732,794,430,403,381,731)
zerocount(1..100S0[37]V[53]Y6G[51]5J[42][38]X[40]XO[38]NSZ[42]XUD[47]1XVKS[52]R[39]JAHH[49][39][50][54]5PBU[42]H3[45][46]DEJ,b=55) = 100,S0[37],V[53]Y,6G[51],5J[42],[38]X[40],XO[38],NSZ,[42]XU,D[47]1,XVK,S[52]R,[39]JA,HH[49],[39][50][54],5PB,U[42]H,3[45][46],DEJ (n=28,865,808,580,366,629,824,612,818,017,012,809,163,332,327,132,687,722,294,521,718,120,736,868,268,650,080,765,802,786,141,387,114)

# Square on a Three String

222 A.D. was the year in which the Emperor Heliogabalus was assassinated by his own soldiers. Exactly 1666 years later, the Anglo-Dutch classicist Sir Lawrence Alma-Tadema exhibited his painting The Roses of Heliogabalus (1888). I suggested in “Roses Are Golden” that Alma-Tadema must have chosen the year as deliberately as he chose the dimensions of his canvas, which, at 52″ x 84 1/8“, is an excellent approximation to the golden ratio.

But did Alma-Tadema know that lines at 0º and 222º divide a circle in the golden ratio? He could easily have done, just as he could easily have known that 222 precedes the 48th prime, 223. But it is highly unlikely that he knew that 223 yields a magic square whose columns, rows and diagonals all sum to 222. To create the square, simply list the 222 multiples of the reciprocal 1/223 in base 3, or ternary. The digits of the reciprocal repeat after exactly 222 digits and its multiples begin and end like this:

001/223 = 0.00001002102101021212111012022211122022... in base 3
002/223 = 0.00002011211202120201222101122200021121...
003/223 = 0.00010021021010212121110120222111220221...
004/223 = 0.00011100200112011110221210022100120020...
005/223 = 0.00012110002220110100102222122012012120...

[...]

218/223 = 0.22210112220002112122120000100210210102... in base 3
219/223 = 0.22211122022110211112001012200122102202...
220/223 = 0.22212201201212010101112102000111002001...
221/223 = 0.22220211011020102021000121100022201101...
222/223 = 0.22221220120121201010111210200011100200...

Each column, row and diagonal of ternary digits sums to 222. Here is the full n/223 square represented with 0s in grey, 1s in white and 2s in red:

(Click for larger)

It isn’t difficult to see that the white squares are mirror-symmetrical on a horizontal axis. Here is the symmetrical pattern rotated by 90º:

(Click for larger)

But why should the 1s be symmetrical? This isn’t something special to 1/223, because it happens with prime reciprocals like 1/7 too:

1/7 = 0.010212... in base 3
2/7 = 0.021201...
3/7 = 0.102120...
4/7 = 0.120102...
5/7 = 0.201021...
6/7 = 0.212010...

And you can notice something else: 0s mirror 2s and 2s mirror 0s. A related pattern appears in base 10:

1/7 = 0.142857...
2/7 = 0.285714...
3/7 = 0.428571...
4/7 = 0.571428...
5/7 = 0.714285...
6/7 = 0.857142...

The digit 1 in the decimal digits of n/7 corresponds to the digit 8 in the decimal digits of (7-n)/7; 4 corresponds to 5; 2 corresponds to 7; 8 corresponds to 1; 5 corresponds to 4; and 7 corresponds to 2. In short, if you’re given the digits d1 of n/7, you know the digits d2 of (n-7)/7 by the rule d2 = 9-d1.

Why does that happen? Examine these sums:

1/7 = 0.142857142857142857142857142857142857142857...
+6/7 = 0.857142857142857142857142857142857142857142...
7/7 = 0.999999999999999999999999999999999999999999... = 1.0

2/7 = 0.285714285714285714285714285714285714285714...
+5/7 = 0.714285714285714285714285714285714285714285...
7/7 = 0.999999999999999999999999999999999999999999... = 1.0

3/7 = 0.428571428571428571428571428571428571428571...
+4/7 = 0.571428571428571428571428571428571428571428...
7/7 = 0.999999999999999999999999999999999999999999... = 1.0

And here are the same sums in ternary (where the first seven integers are 1, 2, 10, 11, 12, 20, 21):

1/21 = 0.010212010212010212010212010212010212010212...
+20/21 = 0.212010212010212010212010212010212010212010...
21/21 = 0.222222222222222222222222222222222222222222... = 1.0

2/21 = 0.021201021201021201021201021201021201021201...
+12/21 = 0.201021201021201021201021201021201021201021...
21/21 = 0.222222222222222222222222222222222222222222... = 1.0

10/21 = 0.102120102120102120102120102120102120102120...
+11/21 = 0.120102120102120102120102120102120102120102...
21/21 = 0.222222222222222222222222222222222222222222... = 1.0

Accordingly, in base b with the prime p, the digits d1 of n/p correspond to the digits (p-n)/p by the rule d2 = (b-1)-d1. This explains why the 1s mirror themselves in ternary: 1 = 2-1 = (3-1)-1. In base 5, the 2s mirror themselves by the rule 2 = 4-2 = (5-1) – 2. In all odd bases, some digit will mirror itself; in all even bases, no digit will. The mirror-digit will be equal to (b-1)/2, which is always an integer when b is odd, but never an integer when b is even.

Here are some more examples of the symmetrical patterns found in odd bases:

Patterns of 1s in 1/19 in base 3

Patterns of 6s in 1/19 in base 13

Patterns of 7s in 1/19 in base 15

Elsewhere other-posted:

Roses Are Golden — more on The Roses of Heliogabalus (1888)
Three Is The Key — more on the 1/223 square

# Amateur ’Grammatics

There is much more to mathematics than mathematics. Like a tree, it has deep roots. Like a tree, it’s affected by its environment. Philosophy of mathematics is concerned with the roots. Psychology of mathematics is concerned with the environment.

On Planet Earth, the environment is human beings. What attracts men and women to the subject? What makes them good or bad at it?And so on. One interesting answer to the first question was supplied by the mathematician Stanislaw Ulam (1909-84), who wrote this in his autobiography:

“In many cases, mathematics is an escape from reality. The mathematician finds his own monastic niche and happiness in pursuits that are disconnected from external affairs. Some practice it as if using a drug.” – Adventures of a Mathematician (1983)

That’s certainly part of maths’ appeal to me: as an escape from reality, or an escape from one reality into another (and deeper). Real life is messy. Maths isn’t, unless you want it to be. But you can find parallels between maths and real life too. In real life, people collect things that they find attractive or interesting: stamps, sea-shells, gems, cigarette-cards, beer-cans and so on. You can collect things in maths too: interesting numbers and number patterns. Recreational maths can feel like looking on a beach for attractive shells and pebbles.

Here’s a good example: digital anagrams, or numbers in different bases whose digits are the same but re-arranged. For example, 13 in base 10 equals 31 in base 4, because 13 = 3 * 4 + 1. To people with the right kind of mind, that’s an interesting and attractive pattern. There are lots more anagrams like that:

1045 = 4501 in base 6
1135 = 5131 in base 6

23 = 32 in base 7
46 = 64 in base 7

1273 = 2371 in base 8
1653 = 3165 in base 8

158 = 185 in base 9
227 = 272 in base 9

196 = 169 in base 11
283 = 238 in base 11

2193 = 1329 in base 12
6053 = 3605 in base 12

43 = 34 in base 13
86 = 68 in base 13

But triple anagrams, involving three bases, seem even more attractive:

913 = 391 in base 16 = 193 in base 26
103462 = 610432 in base 7 = 312046 in base 8
245183 = 413285 in base 9 = 158234 in base 11

And that’s just looking in base 10. If you include all bases, the first double anagram is in fact 21 in base 3 = 12 in base 5 (equals 7 in base 10). The first triple anagram is this:

2C1 in base 13 = 1C2 in base 17 = 12C in base 21 (equals 495 in base 10)

But are there quadruple anagrams, quintuple anagrams and higher? I don’t know. I haven’t found any and it gets harder and harder to search for them, because the bigger n gets, the more bases there are to check. However, I can say one thing for certain: in any given base, anagrams eventually disappear.

To understand why, consider the obvious fact that anagrams have to have the same number of digits in different bases. But the number of digits is a function of the powers of the base. That is, the triple anagram 103462 (see above) has six digits in bases 7, 8 and 10 because 7^5 < 103462 < 7^6, 8^5 < 103462 < 8^6 and 10^5 < 103462 < 10^6. Similarly, the triple anagram 245183 (ditto) has six digits in bases 9, 10 and 11 because 9^5 < 245183 < 9^6, 10^5 < 245183 < 10^6 and 11^5 < 245183 < 11^6:

7^5 < 103462 < 7^6
16807 < 103462 < 117649
8^5 < 103462 < 8^6
32768 < 103462 < 262144
10^5 < 103462 < 10^6
100000 < 103462 < 1000000
9^5 < 245183 < 9^6
59049 < 245183 < 531441
10^5 < 245183 < 10^6
100000 < 245183 < 1000000
11^5 < 245183 < 11^6
161051 < 245183 < 1771561

In other words, for some n the number-lengths of bases 7 and 8 overlap the number-lengths of base 10, which overlap the number-lengths of bases 9 and 11. But eventually, as n gets larger, the number-lengths of base 10 will fall permanently below the number-lengths of bases 7, 8 and 9, just as the number-lengths of base 11 will fall permanently below the number-lengths of base 10.

To see this in action, consider the simplest example: number-lengths in bases 2 and 3. There is no anagram involving these two bases, because only two numbers have the same number of digits in both: 1 and 3 = 11 in base 2 = 10 in base 3. After that, n in base 2 always has more digits than n in base 3:

2^0 = 1 in base 2 (number-length=1) = 1 in base 3 (l=1)
2^1 = 2 = 10 in base 2 (number-length=2) = 2 in base 3 (l=1)
2^2 = 4 = 100 in base 2 (l=3) = 11 in base 3 (l=2)
2^3 = 8 = 1000 in base 2 = 22 in base 3 (l=2)
2^4 = 16 = 10000 in base 2 = 121 in base 3 (l=3)
2^5 = 32 = 1012 in base 3 (l=4)
2^6 = 64 = 2101 in base 3 (l=4)
2^7 = 128 = 11202 in base 3 (l=5)
2^8 = 256 = 100111 in base 3 (l=6)
2^9 = 512 = 200222 in base 3 (l=6)
2^10 = 1024 = 1101221 in base 3 (l=7)

Now consider bases 3 and 4. Here is an anagram using these bases: 211 in base 3 = 112 in base 4 = 22. There are no more anagrams and eventually there’s no more chance for them to occur, because this happens as n gets larger:

3^0 = 1 in base 3 (number-length=1) = 1 in base 4 (l=1)
3^1 = 3 = 10 in base 3 (number-length=2) = 3 in base 4 (l=1)
3^2 = 9 = 100 in base 3 (l=3) = 21 in base 4 (l=2)
3^3 = 27 = 1000 in base 3 (l=4) = 123 in base 4 (l=3)
3^4 = 81 = 10000 in base 3 (l=5) = 1101 in base 4 (l=4)
3^5 = 243 = 100000 in base 3 (l=6) = 3303 in base 4 (l=4)
3^6 = 729 = 23121 in base 4 (l=5)
3^7 = 2187 = 202023 in base 4 (l=6)
3^8 = 6561 = 1212201 in base 4 (l=7)
3^9 = 19683 = 10303203 in base 4 (l=8)
3^10 = 59049 = 32122221 in base 4 (l=8)
3^11 = 177147 = 223033323 in base 4 (l=9)
3^12 = 531441 = 2001233301 in base 4 (l=10)
3^13 = 1594323 = 12011033103 in base 4 (l=11)
3^14 = 4782969 = 102033231321 in base 4 (l=12)
3^15 = 14348907 = 312233021223 in base 4 (l=12)
3^16 = 43046721 = 2210031131001 in base 4 (l=13)
3^17 = 129140163 = 13230220113003 in base 4 (l=14)
3^18 = 387420489 = 113011321011021 in base 4 (l=15)
3^19 = 1162261467 = 1011101223033123 in base 4 (l=16)
3^20 = 3486784401 = 3033311001232101 in base 4 (l=16)

When n is sufficiently large, it always has fewer digits in base 4 than in base 3. And the gap gets steadily bigger. When n doesn’t have the same number of digits in two bases, it can’t be an anagram. A similar number-length gap eventually appears in bases 4 and 5, but the anagrams don’t run out as quickly there:

103 in base 5 = 130 in base 4 = 28
1022 in base 5 = 2021 in base 4 = 137
1320 in base 5 = 3102 in base 4 = 210
10232 in base 5 = 22310 in base 4 = 692
10332 in base 5 = 23031 in base 4 = 717
12213 in base 5 = 32211 in base 4 = 933
100023 in base 5 = 301002 in base 4 = 3138
100323 in base 5 = 302031 in base 4 = 3213
102131 in base 5 = 311120 in base 4 = 3416
102332 in base 5 = 312023 in base 4 = 3467
103123 in base 5 = 313102 in base 4 = 3538
1003233 in base 5 = 3323010 in base 4 = 16068

Base 10 isn’t exempt. Eventually it must outshrink base 9 and be outshrunk by base 11, so what is the highest 9:10 anagram and highest 10:11 anagram? I don’t know: my maths isn’t good enough for me to find out quickly. But using machine code, I’ve found these large anagrams:

205888888872731 = 888883178875022 in base 9
1853020028888858 = 8888888525001032 in base 9
16677181388880888 = 88888888170173166 in base 9

999962734025 = 356099992472 in base 11
9999820360965 = 3205999998606 in base 11
99999993520348 = 29954839390999 in base 11

Note how the digits of n in the lower base are increasing as the digits of n in the higher base are decreasing. Eventually, n in the lower base will always have more digits than n in the higher base. When that happens, there will be no more anagrams.

Some triple anagrams

2C1 in base 13 = 1C2 in base 17 = 12C in base 21 (n=495 = 3^2*5*11)
912 in base 10 = 219 in base 21 = 192 in base 26 (2^4*3*19)
913 in base 10 = 391 in base 16 = 193 in base 26 (11*83)
4B2 in base 15 = 42B in base 16 = 24B in base 22 (n=1067 = 11*97)
5C1 in base 17 = 51C in base 18 = 1C5 in base 35 (n=1650 = 2*3*5^2*11)
3L2 in base 26 = 2L3 in base 31 = 23L in base 35 (n=2576 = 2^4*7*23)
3E1 in base 31 = 1E3 in base 51 = 13E in base 56 (n=3318 = 2*3*7*79)
531 in base 29 = 351 in base 37 = 135 in base 64 (n=4293 = 3^4*53)
D53 in base 18 = 53D in base 29 = 35D in base 37 (n=4305 = 3*5*7*41)
53I in base 29 = 3I5 in base 35 = 35I in base 37 (n=4310 = 2*5*431)
825 in base 25 = 582 in base 31 = 258 in base 49 (n=5055 = 3*5*337)
6S2 in base 31 = 2S6 in base 51 = 26S in base 56 (n=6636 = 2^2*3*7*79)
D35 in base 23 = 5D3 in base 36 = 3D5 in base 46 (n=6951 = 3*7*331)
3K1 in base 49 = 31K in base 52 = 1K3 in base 81 (n=8184 = 2^3*3*11*31)
A62 in base 29 = 6A2 in base 37 = 26A in base 64 (n=8586 = 2*3^4*53)
9L2 in base 30 = 92L in base 31 = 2L9 in base 61 (n=8732 = 2^2*37*59)
3W1 in base 49 = 1W3 in base 79 = 13W in base 92 (n=8772 = 2^2*3*17*43)
G4A in base 25 = AG4 in base 31 = 4AG in base 49 (n=10110 = 2*3*5*337)
J10 in base 25 = 1J0 in base 100 = 10J in base 109 (n=11900 = 2^2*5^2*7*17)
5[41]1 in base 46 = 1[41]5 in base 93 = 15[41] in base 109 (n=12467 = 7*13*137)
F91 in base 29 = 9F1 in base 37 = 19F in base 109 (n=12877 = 79*163)
F93 in base 29 = 9F3 in base 37 = 39F in base 64 (n=12879 = 3^5*53)
AP4 in base 35 = A4P in base 36 = 4AP in base 56 (n=13129 = 19*691)
BP2 in base 36 = B2P in base 37 = 2PB in base 81 (n=15158 = 2*11*13*53)
O6F in base 25 = FO6 in base 31 = 6FO in base 49 (n=15165 = 3^2*5*337)
FQ1 in base 31 = 1QF in base 111 = 1FQ in base 116 (n=15222 = 2*3*43*59)
B74 in base 37 = 7B4 in base 46 = 47B in base 61 (n=15322 = 2*47*163)

# The Rite of Sling

Duels are interesting things. Flashman made his name in one and earnt an impressive scar in another. Maupassant explored their psychology and so did his imitator Maugham. Game theory might be a good guide on how to fight one, but I’d like to look at something simpler: the concept of duelling numbers.

How would two numbers fight? One way is to use digit-sums. Find the digit-sum of each number, then take it away from the other number. Repeat until one or both numbers <= 0, like this:

function duel(n1,n2){
print(n1," <-> ",n2);
do{
s1=digitsum(n1);
s2=digitsum(n2);
n1 -= s2;
n2 -= s1;
print(” -> ",n1," <-> ",n2);
}while(n1>0 && n2>0);
}

Suppose n1 = 23 and n2 = 22. At the first step, s1 = digitsum(23) = 5 and s2 = digitsum(22) = 4. So n1 = 23 – 4 = 19 and n2 = 22 – 5 = 17. And what happens in the end?

23 ↔ 22 ➔ 19 ↔ 17 ➔ 11 ↔ 7 ➔ 4 ↔ 5 ➔ -1 ↔ 1

So 23 loses the duel with 22. Now try 23 vs 24:

23 ↔ 24 ➔ 17 ↔ 19 ➔ 7 ↔ 11 ➔ 5 ↔ 4 ➔ 1 ↔ -1

23 wins the duel with 24. The gap can be bigger. For example, 85 and 100 are what might be called David and Goliath numbers, because the David of 85 beats the Goliath of 100:

85 ↔ 100 ➔ 84 ↔ 87 ➔ 69 ↔ 75 ➔ 57 ↔ 60 ➔ 51 ↔ 48 ➔ 39 ↔ 42 ➔ 33 ↔ 30 ➔ 30 ↔ 24 ➔ 24 ↔ 21 ➔ 21 ↔ 15 ➔ 15 ↔ 12 ➔ 12 ↔ 6 ➔ 6 ↔ 3 ➔ 3 ↔ -3

999 and 1130 are also David and Goliath numbers:

999 ↔ 1130 ➔ 994 ↔ 1103 ➔ 989 ↔ 1081 ➔ 979 ↔ 1055 ➔ 968 ↔ 1030 ➔ 964 ↔ 1007 ➔ 956 ↔ 988 ➔ 931 ↔ 968 ➔ 908 ↔ 955 ➔ 889 ↔ 938 ➔ 869 ↔ 913 ➔ 856 ↔ 890 ➔ 839 ↔ 871 ➔ 823 ↔ 851 ➔ 809 ↔ 838 ➔ 790 ↔ 821 ➔ 779 ↔ 805 ➔ 766 ↔ 782 ➔ 749 ↔ 763 ➔ 733 ↔ 743 ➔ 719 ↔ 730 ➔ 709 ↔ 713 ➔ 698 ↔ 697 ➔ 676 ↔ 674 ➔ 659 ↔ 655 ➔ 643 ↔ 635 ➔ 629 ↔ 622 ➔ 619 ↔ 605 ➔ 608 ↔ 589 ➔ 586 ↔ 575 ➔ 569 ↔ 556 ➔ 553 ↔ 536 ➔ 539 ↔ 523 ➔ 529 ↔ 506 ➔ 518 ↔ 490 ➔ 505 ↔ 476 ➔ 488 ↔ 466 ➔ 472 ↔ 446 ➔ 458 ↔ 433 ➔ 448 ↔ 416 ➔ 437 ↔ 400 ➔ 433 ↔ 386 ➔ 416 ↔ 376 ➔ 400 ↔ 365 ➔ 386 ↔ 361 ➔ 376 ↔ 344 ➔ 365 ↔ 328 ➔ 352 ↔ 314 ➔ 344 ↔ 304 ➔ 337 ↔ 293 ➔ 323 ↔ 280 ➔ 313 ↔ 272 ➔ 302 ↔ 265 ➔ 289 ↔ 260 ➔ 281 ↔ 241 ➔ 274 ↔ 230 ➔ 269 ↔ 217 ➔ 259 ↔ 200 ➔ 257 ↔ 184 ➔ 244 ↔ 170 ➔ 236 ↔ 160 ➔ 229 ↔ 149 ➔ 215 ↔ 136 ➔ 205 ↔ 128 ➔ 194 ↔ 121 ➔ 190 ↔ 107 ➔ 182 ↔ 97 ➔ 166 ↔ 86 ➔ 152 ↔ 73 ➔ 142 ↔ 65 ➔ 131 ↔ 58 ➔ 118 ↔ 53 ➔ 110 ↔ 43 ➔ 103 ↔ 41 ➔ 98 ↔ 37 ➔ 88 ↔ 20 ➔ 86 ↔ 4 ➔ 82 ↔ -10

You can look in the other direction and find bully numbers, or numbers that beat all numbers smaller than themselves. In base 10, the numbers 2 to 9 obviously do. So do these:

35, 36, 37, 38, 39, 47, 48, 49, 58, 59, 64, 65, 66, 67, 68, 69, 76, 77, 78, 79, 189

In other bases, bullies are sometimes common, sometimes rare. Sometimes they don’t exist at all for n > b. Here are bully numbers for bases 2 to 30:

base=2: 3, 5, 7, 13, 15, 21, 27, 29, 31, 37, 43, 45, 47, 54, 59
b=3: 4, 5, 7, 8, 14
b=4: 5, 6, 7, 9, 10, 11, 14, 15, 27, 63
b=5: 12, 13, 14, 18, 19, 23, 24
b=6: 15, 16, 17, 22, 23, 26, 27, 28, 29, 32, 33, 34, 35, 65, 71, 101
b=7: 17, 18, 19, 20, 24, 25, 26, 27, 32, 33, 34, 40, 41, 45, 46, 47, 48, 76
b=8: 37, 38, 39, 46, 47, 59, 60, 61, 62, 63, 95, 103, 111, 119
b=9: 42, 43, 44, 52, 53, 61, 62
b=10: 35, 36, 37, 38, 39, 47, 48, 49, 58, 59, 64, 65, 66, 67, 68, 69, 76, 77, 78, 79, 189
b=11: 38, 39, 40, 41, 42, 43, 49, 50, 51, 52, 53, 54, 62, 63, 64, 65, 73, 74, 75, 76, 85, 86, 87
b=12: 57, 58, 59
b=13: 58, 59, 60, 61, 62, 63, 64, 74, 75, 76, 77, 87, 88, 89, 90, 101, 102, 103, 115, 116, 127, 128, 129
b=14: none (except 2 to 13)
b=15: 116, 117, 118, 119, 130, 131, 132, 133, 134, 147, 148, 149
b=16: 122, 123, 124, 125, 126, 127, 140, 141, 142, 143, 156, 157, 158, 159, 173, 174, 175, 190, 191, 222, 223
b=17: 151, 152, 168, 169, 185, 186
b=18: 85, 86, 87, 88, 89, 191, 192, 193, 194, 195, 196, 197, 212, 213, 214, 215
b=19: 242, 243, 244, 245, 246
b=20: none
b=21: 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 162, 163, 164, 165, 166, 167, 183, 184, 185, 186, 187, 188, 206, 207, 208, 209, 227, 228, 229, 230, 248, 249, 250, 251, 270, 271, 272
b=22: 477, 478, 479, 480, 481, 482, 483
b=23: none
b=24: none
b=25: 271, 272, 273, 274, 296, 297, 298, 299, 322, 323, 324, 348, 349, 372, 373, 374
b=26: none
b=27: none
b=28: none
b=29: 431, 432, 433, 434, 459, 460, 461, 462, 463, 490, 491, 492, 546, 547, 548, 549, 550
b=30: none

# Pair on a D-String

What’s special about the binary number 10011 and the ternary number 1001120221? To answer the question, you have to see double. 10011 contains all possible pairs of numbers created from 0 and 1, just as 1001120221 contains all possible pairs created from 0, 1 and 2. And each pair appears exactly once. Now try the quaternary number 10011202130322331. That contains exactly one example of all possible pairs created from 0, 1, 2 and 3.

But there’s something more: in each case, the number is the smallest possible number with that property. As the bases get higher, that gets less obvious. In quinary, or base 5, the smallest number containing all possible pairs is 10011202130314042232433441. The digits look increasingly random. And what about base 10? There are 100 possible pairs of numbers created from the digits 0 to 9, starting with 00, 01, 02… and ending with …97, 98, 99. To accommodate 100 pairs, the all-pair number in base 10 has to be 101 digits long. It’s a string of digits, so let’s call it a d-string:

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

Again, the digits look increasingly random. They aren’t: they’re strictly determined. The d-string is in harmony. As the digits are generated from the left, they impose restrictions on the digits that appear later. It might appear that you could shift larger digits to the right and make the number smaller, but if you do that you no longer meet the conditions and the d-string collapses into dischord.

Now examine d-strings containing all possible triplets created from the digits of bases 2, 3 and 4:

1, 0, 0, 0, 1, 0, 1, 1, 1, 0 in base 2 = 558 in base 10

1, 0, 0, 0, 1, 0, 1, 1, 0, 2, 0, 0, 2, 1, 1, 1, 2, 0, 1, 2, 1, 2, 2, 0, 2, 2, 2, 1, 0 in base 3 = 23203495920756 in base 10

1, 0, 0, 0, 1, 0, 1, 1, 0, 2, 0, 0, 2, 1, 0, 3, 0, 0, 3, 1, 1, 1, 2, 0, 1, 2, 1, 1, 3, 0, 1, 3, 1, 2, 2, 0, 2, 2, 1, 2, 3, 0, 2, 3, 1, 3, 2, 0, 3, 2, 1, 3, 3, 0, 3, 3, 2, 2, 2, 3, 2, 3, 3, 3, 1, 0 in base 4 = 1366872334420014346556556812432766057460 in base 10

Note that there are 8 possible triplets in base 2, so the all-triplet number has to be 10 digits long. In base 10, there are 1000 possible triplets, so the all-triplet number has to be 1002 digits long. Here it is:

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

Consider the quadruplet number in base 10. There are 10000 possible quadruplets, so the all-quadruplet number is 10003 digits long. And so on. In general, the “all n-tuplet” number in base b contains b^n n-tuplets and is (b^n + n-1) digits long. If b = 10 and n = 4, the d-string starts like this:

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

What about when n = 100? Now the d-string is ungraspably huge – too big to fit in the known universe. But it starts with 1 followed by a hundred 0s and every digit after that is entirely determined. Perhaps there’s a simple way to calculate any given digit, given its position in the d-string. Either way, what is the ontological status of the d-string for n=100? Does it exist in some Platonic realm of number, independent of physical reality?

Some would say that it does, just like √2 or π or e. I disagree. I don’t believe in a Platonic realm. If the universe or multiverse ceased to exist, numbers and mathematics in general would also cease to exist. But this isn’t to say that mathematics depends on physical reality. It doesn’t. Nor does physical reality depend on mathematics. Rather, physical reality necessarily embodies mathematics, which might be defined as “entity in interrelation”. Humans have invented small-m mathematics, a symbolic way of expressing the physical embodiment of big-m mathematics.

But small-m mathematics is actually more powerful and far-ranging, because it increases the number, range and power of entities and their interaction. Where are √2 and π in physical reality? Nowhere. You could say that early mathematicians saw their shadows, cast from a Platonic realm, and deduced their existence in that realm, but that’s a metaphor. Do all events, like avalanches or thunderstorms, exist in some Platonic realm before they are realized? No, they arise as physical entities interact according to laws of physics. In a more abstract way, √2 and π arise as entities of another kind interact according to laws of logic: the concepts of a square and its diagonal, of a circle and its diameter.

The d-strings discussed above arise from the interaction of simpler concepts: the finite set of digits in a base and the ways in which they can be combined. Platonism is unnecessary: the arc and spray of a fountain are explained by the pressure of the water, the design of the pipes, the arrangement of the nozzles, not by reference to an eternal archetype of water and spray. In small-m mathematics, there are an infinite number of fountains, because small-m mathematics opens a door to a big-U universe, infinitely larger and richer than the small-u universe of physical reality.

# Summus

I’m interested in digit-sums and in palindromic numbers. Looking at one, I found the other. It started like this: 9^2 = 81 and 9 = 8 + 1, so digitsum(9^1) = digitsum(9^2). I wondered how long such a sequence of powers could be (excluding powers of 10). I quickly found that the digit-sum of 468 is equal to the digit-sum of its square and cube:

digsum(468) = digsum(219024) = digsum(102503232)

But I couldn’t find any longer sequence, although plenty of other numbers are similar to 468:

digsum(585) = digsum(342225) = digsum(200201625)
digsum(4680) = digsum(21902400) = digsum(102503232000)
digsum(5850) = digsum(34222500) = digsum(200201625000)
digsum(5851) = digsum(34234201) = digsum(200304310051)
digsum(5868) = digsum(34433424) = digsum(202055332032)
digsum(28845) = digsum(832034025) = digsum(24000021451125) […]
digsum(589680) = digsum(347722502400) = digsum(205045005215232000)

What about other bases? First came this sequence:

digsum(2) = digsum(11) (base = 3) (highest power = 2)

Then these:

digsum(4) = digsum(22) = digsum(121) (b=7) (highest power = 3)
digsum(8) = digsum(44) = digsum(242) = digsum(1331) (b=15) (hp=4)
digsum([16]) = digsum(88) = digsum(484) = digsum(2662) = digsum(14641) (b=31) (hp=5)

The pattern continues (a number between square brackets represents a single digit in the base):

digsum([32]) = digsum([16][16]) = digsum(8[16]8) = digsum(4[12][12]4) = digsum(28[12]82) = digsum(15[10][10]51) (b=63) (hp=6)
digsum([64]) = digsum([32][32]) = digsum([16][32][16]) = digsum(8[24][24]8) = digsum(4[16][24][16]4) = digsum(2[10][20][20][10]2) = digsum(16[15][20][15]61) (b=127) (hp=7)
digsum([128]) = digsum([64][64]) = digsum([32][64][32]) = digsum([16][48][48][16]) = digsum(8[32][48][32]8) = digsum(4[20][40][40][20]4) = digsum(2[12][30][40][30][12]2) = digsum(17[21][35][35][21]71) (b=255) (hp=8)
digsum([256]) = digsum([128][128]) = digsum([64][128][64]) = digsum([32][96][96][32]) = digsum([16][64][96][64][16]) = digsum(8[40][80][80][40]8) = digsum(4[24][60][80][60][24]4) = digsum(2[14][42][70][70][42][14]2) = digsum(18[28][56][70][56][28]81) (b=511) (hp=9)

After this, I looked at sequences in which n(i) = n(i-1) + digitsum(n(i-1)). How long could digitsum(n(i)) be greater than or equal to digitsum(n(i-1))? In base 10, I found these sequences:

1 (digitsum=1) → 2 → 4 → 8 → 16 (sum=7) (count=4) (base=10)
9 → 18 (sum=9) → 27 (s=9) → 36 (s=9) → 45 (s=9) → 54 (s=9) → 63 (s=9) → 72 (s=9) → 81 (s=9) → 90 (s=9) → 99 (s=18) → 117 (s=9) (c=11) (b=10)
801 (s=9) → 810 (s=9) → 819 (s=18) → 837 (s=18) → 855 (s=18) → 873 (s=18) → 891 (s=18) → 909 (s=18) → 927 (s=18) → 945 (s=18) → 963 (s=18) → 981 (s=18) → 999 (s=27) → 1026 (s=9) (c=13)

Base 2 does better:

1 → 10 (s=1) → 11 (s=2) → 101 (s=2) → 111 (s=3) → 1010 (s=2) (c=5) (b=2)
16 = 10000 (s=1) → 10001 (s=2) → 10011 (s=3) → 10110 (s=3) → 11001 (s=3) → 11100 (s=3) → 11111 (s=5) → 100100 (s=2) (c=7) (b=2)
962 = 1111000010 (s=5) → 1111000111 (s=7) → 1111001110 (s=7) → 1111010101 (s=7) → 1111011100 (s=7) → 1111100011 (s=7) → 1111101010 (s=7) → 1111110001 (s=7) → 1111111000 (s=7) → 1111111111 (s=10) → 10000001001 (s=3) (c=10) (b=2)
524047 = 1111111111100001111 (s=15) → 1111111111100011110 (s=15) → 1111111111100101101 (s=15) → 1111111111100111100 (s=15) → 1111111111101001011 (s=15) → 1111111111101011010 (s=15) → 1111111111101101001(s=15) → 1111111111101111000 (s=15) → 1111111111110000111 (s=15) → 1111111111110010110 (s=15) → 1111111111110100101 (s=15) → 1111111111110110100 (s=15) → 1111111111111000011 (s=15) → 1111111111111010010 (s=15) → 1111111111111100001 (s=15) → 1111111111111110000 (s=15) → 1111111111111111111 (s=19) → 10000000000000010010 (s=3) (c=17) (b=2)

The best sequence I found in base 3 is shorter than in base 10, but there are more sequences:

1 → 2 → 11 (s=2) → 20 (s=2) → 22 (s=4) → 110 (s=2) (c=5) (b=3)
31 = 1011 (s=3) → 1021 (s=4) → 1102 (s=4) → 1120 (s=4) → 1201 (s=4) → 1212 (s=6) → 2002 (s=4) (c=6) (b=3)
54 = 2000 (s=2) → 2002 (s=4) → 2020 (s=4) → 2101 (s=4) → 2112 (s=6) → 2202 (s=6) → 2222 (s=8) → 10021(s=4) (c=7) (b=3)
432 = 121000 (s=4) → 121011 (s=6) → 121101 (s=6) → 121121 (s=8) → 121220 (s=8) → 122012 (s=8) → 122111 (s=8) → 122210 (s=8) → 200002 (s=4) (c=8) (b=3)
648 = 220000 (s=4) → 220011 (s=6) → 220101 (s=6) → 220121 (s=8) → 220220 (s=8) → 221012 (s=8) → 221111 (s=8) → 221210 (s=8) → 222002 (s=8) → 222101 (s=8) → 222200 (s=8) → 222222 (s=12) → 1000102 (s=4) (c=12) (b=3)

And what about sequences in which digitsum(n(i)) is always greater than digitsum(n(i-1))? Base 10 is disappointing:

1 → 2 → 4 → 8 → 16 (sum=7) (count=4) (base=10)
50 (s=5) → 55 (s=10) → 65 (s=11) → 76 (s=13) → 89 (s=17) → 106 (s=7) (c=5) (b=10)

Some other bases do better:

2 = 10 (s=1) → 11 (s=2) → 101 (s=2) (c=2) (b=2)
4 = 100 (s=1) → 101 (s=2) → 111 (s=3) → 1010 (s=2) (c=3) (b=2)
240 = 11110000 (s=4) → 11110100 (s=5) → 11111001 (s=6) → 11111111 (s=8) → 100000111 (s=4) (c=4) (b=2)

1 → 2 → 11 (s=2) (c=2) (b=3)
19 = 201 (s=3) → 211 (s=4) → 222 (s=6) → 1012 (s=4) (c=3) (b=3)
58999 = 2222221011 (s=15) → 2222221201 (s=16) → 2222222022 (s=18) → 2222222222 (s=20) → 10000000201 (s=4) (c=4) (b=3)

1 → 2 → 10 (s=1) (c=2) (b=4)
4 = 10 (s=1) → 11 (s=2) → 13 (s=4) → 23 (s=5) → 100 (s=1) (c=4) (b=4)
977 = 33101 (s=8) → 33121 (s=10) → 33203 (s=11) → 33232 (s=13) → 33323 (s=14) → 100021 (s=4) (c=5) (b=4)

1 → 2 → 4 → 13 (s=4) (c=3) (b=5)
105 = 410 (s=5) → 420 (s=6) → 431 (s=8) → 444 (s=12) → 1021 (s=4) (c=4) (b=5)

1 → 2 → 4 → 12 (s=3) (c=3) (b=6)
13 = 21 (s=3) → 24 (s=6) → 34 (s=7) → 45 (s=9) → 102 (s=3) (c=4) (b=6)
396 = 1500 (s=6) → 1510 (s=7) → 1521 (s=9) → 1534 (s=13) → 1555 (s=16) → 2023 (s=7) (c=5) (b=6)

1 → 2 → 4 → 11 (s=2) (c=3) (b=7)
121 = 232 (s=7) → 242 (s=8) → 253 (s=10) → 266 (s=14) → 316 (s=10) (c=4) (b=7)
205 = 412 (s=7) → 422 (s=8) → 433 (s=10) → 446 (s=14) → 466 (s=16) → 521 (s=8) (c=5) (b=7)

1 → 2 → 4 → 10 (s=1) (c=3) (b=8)
8 = 10 (s=1) → 11 (s=2) → 13 (s=4) → 17 (s=8) → 27 (s=9) → 40 (s=4) (c=5) (b=8)
323 = 503 (s=8) → 513 (s=9) → 524 (s=11) → 537 (s=15) → 556 (s=16) → 576 (s=18) → 620 (s=8) (c=6) (b=8)

1 → 2 → 4 → 8 → 17 (s=8) (c=4) (b=9)
6481 = 8801 (s=17) → 8820 (s=18) → 8840 (s=20) → 8862 (s=24) → 8888 (s=32) → 10034 (s=8) (c=5) (b=9)

1 → 2 → 4 → 8 → 16 (s=7) (c=4) (b=10)
50 (s=5) → 55 (s=10) → 65 (s=11) → 76 (s=13) → 89 (s=17) → 106 (s=7) (c=5) (b=10)

1 → 2 → 4 → 8 → 15 (s=6) (c=4) (b=11)
1013 = 841 (s=13) → 853 (s=16) → 868 (s=22) → 888 (s=24) → 8[10][10] (s=28) → 925 (s=16) (c=5) (b=11)

1 → 2 → 4 → 8 → 14 (s=5) (c=4) (b=12)
25 = 21 (s=3) → 24 (s=6) → 2[10] (s=12) → 3[10] (s=13) → 4[11] (s=15) → 62 (s=8) (c=5) (b=12)
1191 = 833 (s=14) → 845 (s=17) → 85[10] (s=23) → 879 (s=24) → 899 (s=26) → 8[11][11] (s=30) → 925 (s=16) (c=6) (b=12)

1 → 2 → 4 → 8 → 13 (s=4) (c=4) (b=13)
781 = 481 (s=13) → 491 (s=14) → 4[10]2 (s=16) → 4[11]5 (s=20) → 4[12][12] (s=28) → 521 (s=8) (c=5) (b=13)
19621 = 8[12]14 (s=25) → 8[12]33 (s=26) → 8[12]53 (s=28) → 8[12]75 (s=32) → 8[12]9[11] (s=40) → 8[12][12][12] (s=44) → 9034 (s=16) (c=6) (b=13)

1 → 2 → 4 → 8 → 12 (s=3) (c=4) (b=14)
72 = 52 (s=7) → 59 (s=14) → 69 (s=15) → 7[10] (s=17) → 8[13] (s=21) → [10]6 (s=16) (c=5) (b=14)
1275 = 671 (s=14) → 681 (s=15) → 692 (s=17) → 6[10]5 (s=21) → 6[11][12] (s=29) → 6[13][13] (s=32) → 723 (s=12) (c=6) (b=14)
19026 = 6[13]10 (s=20) → 6[13]26 (s=27) → 6[13]45 (s=28) → 6[13]65 (s=30) → 6[13]87 (s=34) → 6[13][10][13] (s=42) → 6[13][13][13] (s=45) → 7032 (s=12) (c=7) (b=14)

1 → 2 → 4 → 8 → 11 (s=2) (c=4) (b=15)
603 = 2[10]3 (s=15) → 2[11]3 (s=16) → 2[12]4 (s=18) → 2[13]7 (s=22) → 2[14][14] (s=30) → 31[14] (s=18) (c=5) (b=15)
1023 = 483 (s=15) → 493 (s=16) → 4[10]4 (s=18) → 4[11]7 (s=22) → 4[12][14] (s=30) → 4[14][14] (s=32) → 521 (s=8) (c=6) (b=15)
1891 = 861 (s=15) → 871 (s=16) → 882 (s=18) → 895 (s=22) → 8[10][12] (s=30) → 8[12][12] (s=32) → 8[14][14] (s=36) → 925 (s=16) (c=7) (b=15)

1 → 2 → 4 → 8 → 10 (s=1) (c=4) (b=16)
16 = 10 (s=1) → 11 (s=2) → 13 (s=4) → 17 (s=8) → 1[15] (s=16) → 2[15] (s=17) → 40 (s=4) (c=6) (b=16)
1396 = 574 (s=16) → 584 (s=17) → 595 (s=19) → 5[10]8 (s=23) → 5[11][15] (s=31) → 5[13][14] (s=32) → 5[15][14] (s=34) → 620 (s=8) (c=7) (b=16)
2131 = 853 (s=16) → 863 (s=17) → 874 (s=19) → 887 (s=23) → 89[14] (s=31) → 8[11][13] (s=32) → 8[13][13] (s=34) → 8[15][15] (s=38) → 925 (s=16) (c=8) (b=16)

1 → 2 → 4 → 8 → [16] (s=16) → 1[15] (s=16) (c=5) (b=17)

1 → 2 → 4 → 8 → [16] (s=16) → 1[14] (s=15) (c=5) (b=18)
5330 = [16]82 (s=26) → [16]9[10] (s=35) → [16][11]9 (s=36) → [16][13]9 (s=38) → [16][15][11] (s=42) → [16][17][17] (s=50) → [17]2[13] (s=32) (c=6) (b=18)

1 → 2 → 4 → 8 → [16] (s=16) → 1[13] (s=14) (c=5) (b=19)
116339 = [16][18]52 (s=41) → [16][18]75 (s=46) → [16][18]9[13] (s=56) → [16][18][12][12] (s=58) → [16][18][15][13] (s=62) → [16][18][18][18] (s=70) → [17]03[12] (s=32) (c=6) (b=19)

1 → 2 → 4 → 8 → [16] (s=16) → 1[12] (s=13) (c=5) (b=20)
100 = 50 (s=5) → 55 (s=10) → 5[15] (s=20) → 6[15] (s=21) → 7[16] (s=23) → 8[19] (s=27) → [10]6 (s=16) (c=6) (b=20)
135665 = [16][19]35 (s=43) → [16][19]58 (s=48) → [16][19]7[16] (s=58) → [16][19][10][14] (s=59) → [16][19][13][13] (s=61) → [16][19][16][14] (s=65) → [16][19][19][19] (s=73) → [17]03[12] (s=32) (c=7) (b=20)

# Spijit

The only two digits found in all standard bases are 1 and 0. But they behave quite differently. Suppose you take the integers 1 to 100 and compare the number of 1s and 0s in the representation of each integer, n, in bases 2 to n-1. For example, 10 would look like this:

1010 in base 2
101 in base 3
22 in base 4
20 in base 5
14 in base 6
13 in base 7
12 in base 8
11 in base 9

So there are nine 1s and four 0s. If you check 1 to 100 using this all-base function, the count of 1s goes like this:

1, 1, 2, 3, 5, 5, 8, 5, 9, 9, 11, 10, 15, 12, 14, 13, 15, 12, 17, 14, 20, 19, 20, 15, 23, 19, 22, 22, 25, 24, 31, 21, 25, 24, 24, 27, 33, 27, 31, 29, 34, 29, 36, 30, 34, 35, 34, 30, 40, 33, 36, 35, 38, 34, 42, 37, 43, 40, 41, 37, 48, 39, 42, 42, 44, 43, 48, 43, 47, 46, 51, 42, 53, 44, 48, 50, 51, 50, 55, 48, 59, 55, 55, 54, 64, 57, 57, 55, 60, 57, 68, 60, 64, 63, 64, 59, 68, 58, 61, 63.

And the count of 0s goes like this:

0, 1, 0, 2, 1, 2, 0, 4, 4, 4, 2, 5, 1, 2, 2, 7, 4, 8, 4, 7, 4, 3, 1, 8, 4, 4, 6, 8, 4, 7, 1, 10, 8, 7, 7, 12, 5, 6, 5, 10, 4, 8, 2, 6, 7, 4, 2, 12, 6, 9, 7, 8, 4, 11, 6, 10, 5, 4, 2, 12, 2, 3, 5, 14, 11, 13, 7, 10, 8, 11, 5, 17, 7, 8, 10, 10, 8, 10, 4, 13, 12, 10, 8, 16, 8, 7, 7, 12, 6, 14, 6, 8, 5, 4, 4, 16, 6, 10, 11, 15.

The bigger the numbers get, the bigger the discrepancies get. Sometimes the discrepancy is dramatic. For example, suppose you represented the prime 1014719 in bases 2 to 1014718. How 0s would there be? And how many 1s? There are exactly nine zeroes:

1014719 = 11110111101110111111 in base 2 = 1220112221012 in base 3 = 40B27B in base 12 = 1509CE in base 15 = 10[670] in base 1007.

But there are 507723 ones. The same procedure applied to the next integer, 1014720, yields 126 zeroes and 507713 ones. However, there is a way to see that 1s and 0s in the all-base representation are behaving in a similar way. To do this, imagine listing the individual digits of n in bases 2 to n-1 (or just base 2, if n <= 3). When the digits aren’t individual they look like this:

1 = 1 in base 2
2 = 10 in base 2
3 = 11 in base 2
4 = 100 in base 2; 11 in base 3
5 = 101 in base 2; 12 in base 3; 11 in base 4
6 = 110 in base 2; 20 in base 3; 12 in base 4; 11 in base 5
7 = 111 in base 2; 21 in base 3; 13 in base 4; 12 in base 5; 11 in base 6
8 = 1000 in base 2; 22 in base 3; 20 in base 4; 13 in base 5; 12 in base 6; 11 in base 7
9 = 1001 in base 2; 100 in base 3; 21 in base 4; 14 in base 5; 13 in base 6; 12 in base 7; 11 in base 8
10 = 1010 in base 2; 101 in base 3; 22 in base 4; 20 in base 5; 14 in base 6; 13 in base 7; 12 in base 8; 11 in base 9

So the list would look like this:

1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 2, 1, 1, 1, 1, 0, 2, 0, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, 2, 1, 1, 1, 0, 0, 0, 2, 2, 2, 0, 1, 3, 1, 2, 1, 1, 1, 0, 0, 1, 1, 0, 0, 2, 1, 1, 4, 1, 3, 1, 2, 1, 1, 1, 0, 1, 0, 1, 0, 1, 2, 2, 2, 0, 1, 4, 1, 3, 1, 2, 1, 1

Suppose that these digits are compared against the squares of a counter-clockwise spiral on a rectangular grid. If the spiral digit is equal to 1, the square is filled in; if the spijit is not equal to 1, the square is left blank. The 1-spiral looks like this:

Now try zero. If the spijit is equal to 0, the square is filled in; if not, the square is left blank. The 0-spiral looks like this:

And here’s an animated gif of the n-spiral for n = 0..9: