# Agogic Arithmetic

This is one of my favorite integer sequences:

• 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435, 465, 496, 528, 561, 595, 630, 666, 703, 741, 780, 820, 861, 903, 946, 990, 1035, 1081, 1128, 1176, 1225, 1275, 1326, 1378, 1431, ... — A000217 at OEIS

And it’s easy to work out the rule that generates the sequence. It’s the sequence of triangular numbers, of course, which you get by summing the integers:

1
1 + 2 = 3
3 + 3 = 6
6 + 4 = 10
10 + 5 = 15
15 + 6 = 21
21 + 7 = 28
28 + 8 = 36
36 + 9 = 45
[...]

I like this sequence too, but it isn’t a sequence of integers and it’s much harder to work out the rule that generates it:

• 1, 3/2, 11/6, 25/12, 137/60, 49/20, 363/140, 761/280, 7129/2520, 7381/2520, 83711/27720, 86021/27720, 1145993/360360, 1171733/360360...

But you could say that it’s the inverse of the triangular numbers, because you generate it like this:

1
1 + 1/2 = 3/2
3/2 + 1/3 = 11/6
11/6 + 1/4 = 25/12
25/12 + 1/5 = 137/60
137/60 + 1/6 = 49/20
49/20 + 1/7 = 363/140
363/140 + 1/8 = 761/280
761/280 + 1/9 = 7129/2520
[...]

It’s the harmonic series, which is defined at Wikipedia as “the infinite series formed by summing all positive unit fractions”. I can’t understand its subtleties or make any important discoveries about it, but I thought I could ask (and begin to answer) a question that perhaps no-one else in history had ever asked: When are the leading digits of the k-th harmonic number, hs(k), equal to the digits of k in base 10?

hs(1) = 1
hs(43) = 4.349...
hs(714) = 7.1487...
hs(715) = 7.1501...
hs(9763) = 9.76362...
hs(122968) = 12.296899...
hs(122969) = 12.296907...
hs(1478366) = 14.7836639...
hs(17239955) = 17.23995590...
hs(196746419) = 19.6746419...
hs(2209316467) = 22.0931646788...

Do those numbers have any true mathematical significance? I doubt it. But they were fun to find, even though I wasn’t the first person in history to ask about them:

• 1, 43, 714, 715, 9763, 122968, 122969, 1478366, 17239955, 196746419, 2209316467, 24499118645, 268950072605 — A337904 at OEIS, Numbers k such that the decimal expansion of the k-th harmonic number starts with the digits of k, in the same order.

# Magiciprocal

A021023 Decimal expansion of 1/19.

0, 5, 2, 6, 3, 1, 5, 7, 8, 9, 4, 7, 3, 6, 8, 4, 2, 1, 0, 5, 2, 6, 3, 1, 5, 7, 8, 9, 4, 7, 3, 6, 8, 4, 2, 1, 0, 5, 2, 6, 3, 1, 5, 7, 8, 9, 4, 7, 3, 6, 8, 4, 2, 1, 0, 5, 2, 6, 3, 1, 5, 7, 8, 9, 4, 7, 3, 6, 8, 4, 2, 1, 0, 5, 2, 6, 3, 1, 5, 7, 8, 9, 4, 7, 3, 6, 8, 4, 2, 1, 0, 5, 2, 6, 3, 1, 5, 7, 8 [...] The magic square that uses the decimals of 1/19 is fully magic. — A021023 at the Online Encyclopedia of Integer Sequences

# Mötley Vüe

Here’s the Fibonacci sequence, where each term (after the first two) is created by adding the two previous numbers:

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

In “Fib and Let Tri”, I described how my eye was caught by 55, which is a palindrome, reading the same backwards and forwards. “Were there any other Fibonacci palindromes?” I wondered. So I looked to see. Now my eye has been caught by 55 again, but for another reason. It should be easy to spot another interesting aspect to 55 when the Fibonacci numbers are set out like this:

fib(1) = 1
fib(2) = 1
fib(3) = 2
fib(4) = 3
fib(5) = 5
fib(6) = 8
fib(7) = 13
fib(8) = 21
fib(9) = 34
fib(10) = 55
fib(11) = 89
fib(12) = 144
fib(13) = 233
fib(14) = 377
fib(15) = 610
fib(16) = 987
fib(17) = 1597
fib(18) = 2584
fib(19) = 4181
fib(20) = 6765
[...]

55 is fib(10), the 10th Fibonacci number, and 5+5 = 10. That is, digsum(fib(10)) = 10. What other Fibonacci numbers work like that? I soon found some and confirmed my answer at the Online Encyclopedia of Integer Sequences:

1, 5, 10, 31, 35, 62, 72, 175, 180, 216, 251, 252, 360, 494, 504, 540, 946, 1188, 2222 — A020995 at OEIS

And that seems to be the lot, according to the OEIS. In base 10, at least, but why stop at base 10? When I looked at base 11, the numbers of digsum(fib(k)) = k didn’t stop coming, because I couldn’t take the Fibonacci numbers very high on my computer. But the OEIS gives a much longer list, starting like this:

1, 5, 13, 41, 53, 55, 60, 61, 90, 97, 169, 185, 193, 215, 265, 269, 353, 355, 385, 397, 437, 481, 493, 617, 629, 630, 653, 713, 750, 769, 780, 889, 905, 960, 1013, 1025, 1045, 1205, 1320, 1405, 1435, 1501, 1620, 1650, 1657, 1705, 1735, 1769, 1793, 1913, 1981, 2125, 2153, 2280, 2297, 2389, 2413, 2460, 2465, 2509, 2533, 2549, 2609, 2610, 2633, 2730, 2749, 2845, 2893, 2915, 3041, 3055, 3155, 3209, 3360, 3475, 3485, 3521, 3641, 3721, 3749, 3757, 3761, 3840, 3865, 3929, 3941, 4075, 4273, 4301, 4650, 4937, 5195, 5209, 5435, 5489, 5490, 5700, 5917, 6169, 6253, 6335, 6361, 6373, 6401, 6581, 6593, 6701, 6750, 6941, 7021, 7349, 7577, 7595, 7693, 7740, 7805, 7873, 8009, 8017, 8215, 8341, 8495, 8737, 8861, 8970, 8995, 9120, 9133, 9181, 9269, 9277, 9535, 9541, 9737, 9935, 9953, 10297, 10609, 10789, 10855, 11317, 11809, 12029, 12175... — A020995 at OEIS

The list ends with 1636597 = A18666[b11] and the OEIS says that 1636597 almost certainly completes the list. According to David C. Terr’s paper “On the Sums of Fibonacci Numbers” (pdf), published in the Fibonacci Quarterly in 1996, the estimated digit-sum for the k-th Fibonacci number in base b is given by the formula (b-1)/2 * k * log(b,φ), where log(b,φ) is the logarithm in base b of the golden ratio, 1·61803398874… Terr then notes that the simplified formula (b-1)/2 * log(b,φ) gives the estimated average ratio digsum(fib(k)) / k in base b. Here are the estimates for bases 2 to 20:

b02 = 0.3471209568153086...
b03 = 0.4380178794859424...
b04 = 0.5206814352229629...
b05 = 0.5979874356654401...
b06 = 0.6714235829697111...
b07 = 0.7418818776805580...
b08 = 0.8099488992357201...
b09 = 0.8760357589718848...
b10 = 0.9404443811249043...
b11 = 1.0034045909311624...
b12 = 1.0650963641043091...
b13 = 1.1256639207937723...
b14 = 1.1852250528196852...
b15 = 1.2438775226715552...
b16 = 1.3017035880574074...
b17 = 1.3587732842474014...
b18 = 1.4151468584732730...
b19 = 1.4708766105122322...
b20 = 1.5260083080264088...

In base 2, you can expect digsum(fib(k)) to be much smaller than k; in base 20, you can expect digsum(fib(k)) to be much larger. But as you can see, the estimate for base 11, 1.0034045909311624…, is very nearly 1. That’s why base 11 produces so many results for digsum(fib(k)) = k, because only a slight deviation from the estimate might create a perfect ratio of 1 for digsum(fib(k)) / k, i.e. digsum(fib(k)) = k. But in the end the results run out in base 11 too, because as k gets higher and fib(k) gets bigger, the estimate becomes more and more accurate and digsum(fib(k)) > k. With lower k, digsum(fib(k)) can easily fall below k or match k. That happens in other bases, but because their estimates are further from 1, results for digsum(fib(k)) = k run out much more quickly.

To see this base behavior represented visually, I’ve created Ulam-like spirals for k using three colors: blue for digsum(fib(k)) < k, yellow for digsum(fib(k)) > k, and red for digsum(fib(k)) = k (with the green square at the center representing fib(1) = 1). As you can see below, the spiral for base 11 immediately stands out. It’s motley, not dominated by blue or yellow like the other spirals:

Spiral for digsum(fib(k)) in base 9
(blue for digsum(fib(k)) < k, yellow for digsum(fib(k)) > k, red for digsum(fib(k)) = k, green for fib(1))

Spiral for digsum(fib(k)) in base 10

Spiral for digsum(fib(k)) in base 11 — a motley view of blue, yellow and red

Spiral for digsum(fib(k)) in base 12

Spiral for digsum(fib(k)) in base 13

Finally, here are spirals at higher and higher resolution for digsum(fib(k)) = k in base 11:

digsum(fib(k)) = k in base 11 (low resolution)
(green square is fib(1))

digsum(fib(k)) = k in base 11 (x2 resolution)

digsum(fib(k)) = k in base 11 (x4)

digsum(fib(k)) = k in base 11 (x8)

digsum(fib(k)) = k in base 11 (x16)

digsum(fib(k)) = k in base 11 (x32)

digsum(fib(k)) = k in base 11 (x64)

digsum(fib(k)) = k in base 11 (x128)

digsum(fib(k)) = k in base 11 (animated)

# Count Amounts

One of my favourite integer sequences is what I call the digit-line. You create it by taking this very familiar integer sequence:

• 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20…

And turning it into this one:

• 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 2, 0… (A033307 in the Online Encyclopedia of Integer Sequences)

You simply chop all numbers into single digits. What could be simpler? Well, creating the digit-line couldn’t be simpler, but it is in fact a very complex object. There are hidden depths in its patterns, as even a brief look will uncover. For example, you can try counting the digits as they appear one-by-one in the line and seeing whether the digit-counts compare. Do the 1s of the digit-line always outnumber the 0s, as you might expect? Yes, they do (unless you start the digit-line 0, 1, 2, 3…). But do the 2s always outnumber the 0s? No: at position 2, there’s a 2, and at position 11 there’s a 0. So that’s one 2 and one 0. Does it happen again? Yes, it happens again at the 222nd digit of the digit-line, as below:

1, 2count=1, 3, 4, 5, 6, 7, 8, 9, 1, 0count=1, 1, 1, 1, 22, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 23, 02, 24, 1, 25, 26, 27, 3, 28, 4, 29, 5, 210, 6, 211, 7, 212, 8, 213, 9, 3, 03, 3, 1, 3, 214, 3, 3, 3, 4, 3, 5, 3, 6, 3, 7, 3, 8, 3, 9, 4, 04, 4, 1, 4, 215, 4, 3, 4, 4, 4, 5, 4, 6, 4, 7, 4, 8, 4, 9, 5, 05, 5, 1, 5, 216, 5, 3, 5,4, 5, 5, 5, 6, 5, 7, 5, 8, 5, 9, 6, 06, 6, 1, 6, 217, 6, 3, 6, 4, 6, 5, 6, 6, 6, 7, 6, 8, 6, 9, 7, 07, 7, 1, 7, 218, 7, 3, 7, 4, 7, 5, 7, 6, 7, 7, 7, 8, 7, 9, 8, 08, 8, 1, 8, 219, 8, 3, 8, 4, 8, 5, 8, 6, 8, 7, 8, 8, 8, 9, 9, 09, 9, 1, 9, 220, 9, 3, 9, 4, 9, 5, 9, 6, 9, 7, 9, 8, 9, 9, 1, 010, 011, 1, 012, 1, 1, 013, 221, 1, 014, 3, 1, 015, 4, 1, 016, 5, 1, 017, 6, 1, 018, 7, 1, 019, 8, 1, 020, 9, 1, 1, 021

So count(2) = count(0) = 1 at digit 11 of the digit-line in the 0 of what was originally 10. And count(2) = count(0) = 21 @ digit 222 in the 0 of what was originally 110. Is a pattern starting to emerge? Yes, it is. Here are the first few points at which the count(2) = count(0) in the digit-line of base 10:

1 @ 11 in 10
21 @ 222 in 110
321 @ 3333 in 1110
4321 @ 44444 in 11110
54321 @ 555555 in 111110
654321 @ 6666666 in 1111110
7654321 @ 77777777 in 11111110
87654321 @ 888888888 in 111111110
987654321 @ 9999999999 in 1111111110
10987654321 @ 111111111110 in 11111111110
120987654321 @ 1222222222221 in 111111111110
[...]

The count(2) = count(0) = 321 at position 3333 in the digit-line, and 4321 at position 44444, and 54321 at position 555555, and so on. I don’t understand why these patterns occur, but you can predict the count-and-position of 2s and 0s easily until position 9999999999, after which things become more complicated. Related patterns for 2 and 0 occur in all other bases except binary (which doesn’t have a 2 digit). Here’s base 6:

1 @ 11 in 10 (1 @ 7 in 6)
21 @ 222 in 110 (13 @ 86 in 42)
321 @ 3333 in 1110 (121 @ 777 in 258)
4321 @ 44444 in 11110 (985 @ 6220 in 1554)
54321 @ 555555 in 111110 (7465 @ 46655 in 9330)
1054321 @ 11111110 in 1111110 (54121 @ 335922 in 55986)
12054321 @ 122222221 in 11111110 (380713 @ 2351461 in 335922)
132054321 @ 1333333332 in 111111110 (2620201 @ 16124312 in 2015538)
1432054321 @ 14444444443 in 1111111110 (17736745 @ 108839115 in 12093234)
15432054321 @ 155555555554 in 11111111110 (118513705 @ 725594110 in 72559410)
205432054321 @ 2111111111105 in 111111111110 (783641641 @ 4788921137 in 435356466)
2205432054321 @ 22222222222220 in 1111111111110 (5137206313 @ 31345665636 in 2612138802)

And what about comparing other pairs of digits? In fact, the count of all digits except 0 matches infinitely often. To write the numbers 1..9 takes one of each digit (except 0). To write the numbers 1 to 99 takes twenty of each digit (except 0). Here’s the proof:

11, 21, 31, 41, 51, 61, 71, 81, 91, 12, 01, 13, 14, 15, 22, 16, 32, 17, 42, 18, 52, 19, 62, 110, 72, 111, 82, 112, 92, 23, 02, 24, 113, 25, 26, 27, 33, 28, 43, 29, 53, 210, 63, 211, 73, 212, 83, 213, 93, 34, 03, 35, 114, 36, 214, 37, 38, 39, 44, 310, 54, 311, 64, 312, 74, 313, 84, 314, 94, 45, 04, 46, 115, 47, 215, 48, 315, 49, 410, 411, 55, 412, 65, 413, 75, 414, 85, 415, 95, 56, 05, 57, 116, 58, 216, 59, 316, 510, 416, 511, 512, 513, 66, 514, 76, 515, 86, 516, 96, 67, 06, 68, 117, 69, 217, 610, 317, 6
11
, 417, 612, 517, 613, 614, 615, 77, 616, 87, 617, 97, 78, 07, 79, 118, 710, 218, 711, 318, 712, 418, 713, 518, 714, 618, 715, 716, 717, 88, 718, 98, 89, 08, 810, 119, 811, 219, 812, 319, 813, 419, 814, 519, 815, 619, 816, 719, 817, 818, 819, 99, 910, 09, 911, 120, 912, 220, 913, 320, 914, 420, 915, 520, 916, 620, 917, 720, 918, 820, 919, 920

And what about writing 1..999, 1..9999, and so on? If you think about it, for every pair of non-zero digits, d1 and d2, all numbers containing one digit can be matched with a number containing the other. 100 → 200, 111 → 222, 314 → 324, 561189571 → 562289572, and so on. So in counting 1..999, 1..9999, 1..99999, you use the same number of non-zero digits. And once again a pattern emerges:

count(0) = 0; count(1) = 1; count(2) = 1; count(3) = 1; count(4) = 1; count(5) = 1; count(6) = 1; count(7) = 1; count(8) = 1; count(9) = 1 (writing 1..9)
count(0) = 9; count(1) = 20; count(2) = 20; count(3) = 20; count(4) = 20; count(5) = 20; count(6) = 20; count(7) = 20; count(8) = 20; count(9) = 20 (writing 1..99)
0: 189; 1: 300; 2: 300; 3: 300; 4: 300; 5: 300; 6: 300; 7: 300; 8: 300; 9: 300 (writing 1..999)
0: 2889; 1: 4000; 2: 4000; 3: 4000; 4: 4000; 5: 4000; 6: 4000; 7: 4000; 8: 4000; 9: 4000 (writing 1..9999)
0: 38889; 1: 50000; 2: 50000; 3: 50000; 4: 50000; 5: 50000; 6: 50000; 7: 50000; 8: 50000; 9: 50000 (writing 1..99999)
0: 488889; 1: 600000; 2: 600000; 3: 600000; 4: 600000; 5: 600000; 6: 600000; 7: 600000; 8: 600000; 9: 600000 (writing 1..999999)
0: 5888889; 1: 7000000; 2: 7000000; 3: 7000000; 4: 7000000; 5: 7000000; 6: 7000000; 7: 7000000; 8: 7000000; 9: 7000000 (writing 1..9999999)
[...]

And here’s base 6 again:

0: 0; 1: 1; 2: 1; 3: 1; 4: 1; 5: 1 (writing 1..5)
0: 5; 1: 20; 2: 20; 3: 20; 4: 20; 5: 20 (writing 1..55 in base 6)
0: 145; 1: 300; 2: 300; 3: 300; 4: 300; 5: 300 (writing 1..555)
0: 2445; 1: 4000; 2: 4000; 3: 4000; 4: 4000; 5: 4000 (writing 1..5555)
0: 34445; 1: 50000; 2: 50000; 3: 50000; 4: 50000; 5: 50000 (writing 1..55555)
0: 444445; 1: 1000000; 2: 1000000; 3: 1000000; 4: 1000000; 5: 1000000 (writing 1..555555)
0: 5444445; 1: 11000000; 2: 11000000; 3: 11000000; 4: 11000000; 5: 11000000 (writing 1..5555555)
0: 104444445; 1: 120000000; 2: 120000000; 3: 120000000; 4: 120000000; 5: 120000000 (writing 1..55555555)
0: 1144444445; 1: 1300000000; 2: 1300000000; 3: 1300000000; 4: 1300000000; 5: 1300000000 (writing 1..555555555)

# B a Pal

As a keyly committed core component of the counter-cultural community (I wish!), I like to post especially edgy and esoteric material to Overlord In Terms of Core Issues Around Maximal Engagement with Key Notions of the Über-Feral on the 23rd of each month. And today I may be posting the especially edgiest and esoterickest material ever dot dot dot

After all, this entry at the Online Encyclopedia of Integer Sequences is about numbers that are palindromes in two particularly pertinent bases:

A060792 Numbers that are palindromic in bases 2 and 3.

0, 1, 6643, 1422773, 5415589, 90396755477, 381920985378904469, 1922624336133018996235, 2004595370006815987563563, 8022581057533823761829436662099, 392629621582222667733213907054116073, 32456836304775204439912231201966254787, 428027336071597254024922793107218595973 (A060792 at OEIS, with more entries)

And here are the underlying palindromes:

0: 0 ↔ 0
1: 1 ↔ 1
6643: 1100111110011 ↔ 100010001
1422773: 101011011010110110101 ↔ 2200021200022
5415589: 10100101010001010100101 ↔ 101012010210101
90396755477: 1010100001100000100010000011000010101 ↔ 22122022220102222022122
381920985378904469: 10101001100110110110001110011011001110001101101100110010101 ↔ 2112200222001222121212221002220022112
1922624336133018996235: 11010000011100111000101110001110011011001110001110100011100111000001011 ↔
122120102102011212112010211212110201201021221
2004595370006815987563563: 110101000011111010101010100101111011110111011110111101001010101010111110000101011 ↔ 221010112100202002120002212200021200202001211010122
8022581057533823761829436662099: 1100101010000100101101110000011011011111111011000011100001101111111101101100000111011010010000101010011 ↔ 21000020210011222122220212010000100001021202222122211001202000012
392629621582222667733213907054116073: 10010111001111000100010100010100000011011011000101011011100000111011010100011011011000000101000101000100011110011101001 ↔ 122102120011102000101101000002010021111120010200000101101000201110021201221
32456836304775204439912231201966254787: 11000011010101111010110010100010010011011010101001101000001000100010000010110010101011011001001000101001101011110101011000011 ↔ 1222100201002211120110022121002012121101011212102001212200110211122001020012221
428027336071597254024922793107218595973: 101000010000000110001000011111100101011110011100001110100011100010001110001011100001110011110101001111110000100011000000010000101 ↔ 222001200110022102121001000200200202022111220202002002000100121201220011002100222

# Binary Babushkas

What’s the connection between grandmothers and this set of numbers?

1, 2, 6, 12, 44, 92, 184, 1208, 1256, 4792, 9912, 19832, 39664, 563952, 576464, 4496112, 4499184, 17996528, 17997488, 143972080, 145057520, 145070832, 294967024, 589944560...

To take the first step towards the answer, you need to put the numbers into binary:

1, 10, 110, 1100, 101100, 1011100, 10111000, 10010111000, 10011101000, 1001010111000, 10011010111000, 100110101111000, 1001101011110000, 10001001101011110000, 10001100101111010000, 10001001001101011110000, 10001001010011011110000, 1000100101001101011110000, 1000100101001111010110000, 1000100101001101011011110000, 1000101001010110011011110000, 1000101001011001101011110000, 10001100101001101011011110000, 100011001010011101011011110000...

The second step is compare those binary numbers with these binary numbers, which represent 1 to 30:

1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111, 10000, 10001, 10010, 10011, 10100, 10101, 10110, 10111, 11000, 11001, 11010, 11011, 11100, 11101, 11110...

To see what’s going on, take the first five numbers from each set:

• 1, 10, 110, 1100, 101100...
• 1, 10, 11, 100, 101...

What’s going on? If you look, you can see the n-th binary number of set 1 contains the digits of all binary numbers <= n in set 2. For example, 101100 is the 5th binary number in set 1, so it contains the digits of the binary numbers 1 to 5:

101100 ← 1
101100 ← 10
101100 ← 11
101100 ← 100
101100 ← 101

Now try 1256 = 10,011,101,000, the ninth number in set 1. It contains all the binary numbers from 1 to 1001:

10011101000 ← 1 (n=1)
10011101000 ← 10 (n=2)
10011101000 ← 11 (n=3)
10011101000 ← 100 (n=4)
10011101000 ← 101 (n=5)
10011101000 ← 110 (n=6)
10011101000 ← 111 (n=7)
10011101000 ← 1000 (n=8)
10011101000 ← 1001 (n=9)

But where do grandmothers come in? They come in via this famous toy:

Nested doll or Russian doll

It’s called a Russian doll and the way all the smaller dolls pack inside the largest doll reminds me of the way all the smaller numbers 1 to 1010 pack into 1001010111000. But in the Russian language, as you might expect, Russian dolls aren’t called Russian dolls. Instead, they’re called matryoshki (матрёшки, singular матрёшка), meaning “little matrons”. However, there’s a mistaken idea in English that in Russian they’re called babushka dolls, from Russian бабушка, babuška, meaning “grandmother”. And that’s what I thought, until I did a little research.

But the mistake is there, so I’ll call these babushka numbers or grandmother numbers:

1, 2, 6, 12, 44, 92, 184, 1208, 1256, 4792, 9912, 19832, 39664, 563952, 576464, 4496112, 4499184, 17996528, 17997488, 143972080, 145057520, 145070832, 294967024, 589944560...

They’re sequence A261467 at the Online Encyclopedia of Integer Sequences. They go on for ever, but the biggest known so far is 589,944,560 = 100,011,001,010,011,101,011,011,110,000 in binary. And here is that binary babushka with its binary babies:

100011001010011101011011110000 ← 1 (n=1)
100011001010011101011011110000 ← 10 (n=2)
100011001010011101011011110000 ← 11 (n=3)
100011001010011101011011110000 ← 100 (n=4)
100011001010011101011011110000 ← 101 (n=5)
100011001010011101011011110000 ← 110 (n=6)
100011001010011101011011110000 ← 111 (n=7)
100011001010011101011011110000 ← 1000 (n=8)
100011001010011101011011110000 ← 1001 (n=9)
100011001010011101011011110000 ← 1010 (n=10)
100011001010011101011011110000 ← 1011 (n=11)
100011001010011101011011110000 ← 1100 (n=12)
100011001010011101011011110000 ← 1101 (n=13)
100011001010011101011011110000 ← 1110 (n=14)
100011001010011101011011110000 ← 1111 (n=15)
100011001010011101011011110000 ← 10000 (n=16)
100011001010011101011011110000 ← 10001 (n=17)
100011001010011101011011110000 ← 10010 (n=18)
100011001010011101011011110000 ← 10011 (n=19)
100011001010011101011011110000 ← 10100 (n=20)
100011001010011101011011110000 ← 10101 (n=21)
100011001010011101011011110000 ← 10110 (n=22)
100011001010011101011011110000 ← 10111 (n=23)
100011001010011101011011110000 ← 11000 (n=24)
100011001010011101011011110000 ← 11001 (n=25)
100011001010011101011011110000 ← 11010 (n=26)
100011001010011101011011110000 ← 11011 (n=27)
100011001010011101011011110000 ← 11100 (n=28)
100011001010011101011011110000 ← 11101 (n=29)
100011001010011101011011110000 ← 11110 (n=30)

Babushka numbers exist in higher bases, of course. Here are the first thirteen in base 3 or ternary:

1 contains 1 (c=1) (n=1)
12 contains 1, 2 (c=2) (n=5)
102 contains 1, 2, 10 (c=3) (n=11)
1102 contains 1, 2, 10, 11 (c=4) (n=38)
10112 contains 1, 2, 10, 11, 12 (c=5) (n=95)
101120 contains 1, 2, 10, 11, 12, 20 (c=6) (n=285)
1021120 contains 1, 2, 10, 11, 12, 20, 21 (c=7) (n=933)
10211220 contains 1, 2, 10, 11, 12, 20, 21, 22 (c=8) (n=2805)
100211220 contains 1, 2, 10, 11, 12, 20, 21, 22, 100 (c=9) (n=7179)
10021011220 contains 1, 2, 10, 11, 12, 20, 21, 22, 100, 101 (c=10) (n=64284)
1001010211220 contains 1, 2, 10, 11, 12, 20, 21, 22, 100, 101, 102 (c=11) (n=553929)
1001011021220 contains 1, 2, 10, 11, 12, 20, 21, 22, 100, 101, 102, 110 (c=12) (n=554253)
10010111021220 contains 1, 2, 10, 11, 12, 20, 21, 22, 100, 101, 102, 110, 111 (c=13) (n=1663062)

Look at 1,001,010,211,220 (n=553929) and 1,001,011,021,220 (n=554253). They have the same number of digits, but the babushka 1,001,011,021,220 manages to pack in one more baby:

1001010211220 contains 1, 2, 10, 11, 12, 20, 21, 22, 100, 101, 102 (c=11) (n=553929)
1001011021220 contains 1, 2, 10, 11, 12, 20, 21, 22, 100, 101, 102, 110 (c=12) (n=554253)

That happens in binary too:

10010111000 contains 1, 10, 11, 100, 101, 110, 111, 1000, 1001 (c=9) (n=1208)
10011101000 contains 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010 (c=10) (n=1256)

What happens in higher bases? Watch this space.

# Pi and By

Here’s √2 in base 2:

√2 = 1.01101010000010011110... (base=2)

And in base 3:

√2 = 1.10201122122200121221... (base=3)

And in bases 4, 5, 6, 7, 8, 9 and 10:

√2 = 1.12220021321212133303... (b=4)
√2 = 1.20134202041300003420... (b=5)
√2 = 1.22524531420552332143... (b=6)
√2 = 1.26203454521123261061... (b=7)
√2 = 1.32404746317716746220... (b=8)
√2 = 1.36485805578615303608... (b=9)
√2 = 1.41421356237309504880... (b=10)

And here’s π in the same bases:

π = 11.00100100001111110110... (b=2)
π = 10.01021101222201021100... (b=3)
π = 03.02100333122220202011... (b=4)
π = 03.03232214303343241124... (b=5)
π = 03.05033005141512410523... (b=6)
π = 03.06636514320361341102... (b=7)
π = 03.11037552421026430215... (b=8)
π = 03.12418812407442788645... (b=9)
π = 03.14159265358979323846... (b=10)

Mathematicians know that in all standard bases, the digits of √2 and π go on for ever, without falling into any regular pattern. These numbers aren’t merely irrational but transcedental. But are they also normal? That is, in each base b, do the digits 0 to [b-1] occur with the same frequency 1/b? (In general, a sequence of length l will occur in a normal number with frequency 1/(b^l).) In base 2, are there as many 1s as 0s in the digits of √2 and π? In base 3, are there as many 2s as 1s and 0s? And so on.

It’s a simple question, but so far it’s proved impossible to answer. Another question starts very simple but quickly gets very difficult. Here are the answers so far at the Online Encyclopedia of Integer Sequences (OEIS):

2, 572, 8410815, 59609420837337474 – A049364

The sequence is defined as the “Smallest number that is digitally balanced in all bases 2, 3, … n”. In base 2, the number 2 is 10, which has one 1 and one 0. In bases 2 and 3, 572 = 1000111100 and 210012, respectively. 1000111100 has five 1s and five 0s; 210012 has two 2s, two 1s and two 0s. Here are the numbers of A049364 in the necessary bases:

10 (n=2)
1000111100, 210012 (n=572)
100000000101011010111111, 120211022110200, 200011122333 (n=8410815)
11010011110001100111001111010010010001101011100110000010, 101201112000102222102011202221201100, 3103301213033102101223212002, 1000001111222333324244344 (n=59609420837337474)

But what number, a(6), satisfies the definition for bases 2, 3, 4, 5 and 6? According to the notes at the OEIS, a(6) > 5^434. That means finding a(6) is way beyond the power of present-day computers. But I assume a quantum computer could crack it. And maybe someone will come up with a short-cut or even an algorithm that supplies a(b) for any base b. Either way, I think we’ll get there, π and by.

# Gyp Cip

Abundance often overwhelms, but restriction reaps riches. That’s true in mathematics and science, where you can often understand the whole better by looking at only a part of it first — restriction reaps riches. Egyptian fractions are one example in maths. In ancient Egypt, you could have any kind of fraction you liked so long as it was a reciprocal like 1/2, 1/3, 1/4 or 1/5 (well, there were two exceptions: 2/3 and 3/4 were also allowed).

So when mathematicians speak of “Egyptian fractions”, they mean those fractions that can be represented as a sum of reciprocals. Egyptian fractions are restricted and that reaps riches. Here’s one example: how many ways can you add n distinct reciprocals to make 1? When n = 1, there’s one way to do it: 1/1. When n = 2, there’s no way to do it, because 1 – 1/2 = 1/2. Therefore the summed reciprocals aren’t distinct: 1/2 + 1/2 = 1. After that, 1 – 1/3 = 2/3, 1 – 1/4 = 3/4, and so on. By the modern meaning of “Egyptian fraction”, there’s no solution for n = 2.

However, when n = 3, there is a way to do it:

• 1/2 + 1/3 + 1/6 = 1

But that’s the only way. When n = 4, things get better:

• 1/2 + 1/4 + 1/6 + 1/12 = 1
• 1/2 + 1/3 + 1/10 + 1/15 = 1
• 1/2 + 1/3 + 1/9 + 1/18 = 1
• 1/2 + 1/4 + 1/5 + 1/20 = 1
• 1/2 + 1/3 + 1/8 + 1/24 = 1
• 1/2 + 1/3 + 1/7 + 1/42 = 1

What about n = 5, n = 6 and so on? You can find the answer at the Online Encyclopedia of Integer Sequences (OEIS), where sequence A006585 is described as “Egyptian fractions: number of solutions to 1 = 1/x1 + … + 1/xn in positive integers x1 < … < xn”. The sequence is one of the shortest and strangest at the OEIS:

• 1, 0, 1, 6, 72, 2320, 245765, 151182379

When n = 1, there’s one solution: 1/1. When n = 2, there’s no solution, as I showed above. When n = 3, there’s one solution again. When n = 4, there are six solutions. And the OEIS tells you how many solutions there are for n = 5, 6, 7, 8. But n >= 9 remains unknown at the time of writing.

To understand the problem, consider the three reciprocals, 1/2, 1/3 and 1/5. How do you sum them? They have different denominators, 2, 3 and 5, so you have to create a new denominator, 30 = 2 * 3 * 5. Then you have to adjust the numerators (the numbers above the fraction bar) so that the new fractions have the same value as the old:

• 1/2 = 15/30 = (2*3*5 / 2) / 30
• 1/3 = 10/30 = (2*3*5 / 3) / 30
• 1/5 = 06/30 = (2*3*5 / 5) / 30
• 15/30 + 10/30 + 06/30 = (15+10+6) / 30 = 31/30 = 1 + 1/30

Those three reciprocals don’t sum to 1. Now try 1/2, 1/3 and 1/6:

• 1/2 = 18/36 = (2*3*6 / 2) / 36
• 1/3 = 12/36 = (2*3*6 / 3) / 36
• 1/6 = 06/36 = (2*3*6 / 6) / 36
• 18/36 + 12/36 + 06/36 = (18+12+6) / 36 = 36/36 = 1

So when n = 3, the problem consists of finding three reciprocals, 1/a, 1/b and 1/c, such that for a, b, and c:

• a*b*c = a*b + a*c + b*c

There is only one solution: a = 2, b = 3 and c = 6. When n = 4, the problem consists of finding four reciprocals, 1/a, 1/b, 1/c and 1/d, such that for a, b, c and d:

• a*b*c*d = a*b*c + a*b*d + a*c*d + b*c*d

For example:

• 2*4*6*12 = 576
• 2*4*6 + 2*4*12 + 2*6*12 + 4*6*12 = 48 + 96 + 144 + 288 = 576
• 2*4*6*12 = 2*4*6 + 2*4*12 + 2*6*12 + 4*6*12 = 576

Therefore:

• 1/2 + 1/4 + 1/6 + 1/12 = 1

When n = 5, the problem consists of finding five reciprocals, 1/a, 1/b, 1/c, 1/d and 1/e, such that for a, b, c, d and e:

• a*b*c*d*e = a*b*c*d + a*b*c*e + a*b*d*e + a*c*d*e + b*c*d*e

There are 72 solutions and here they are:

• 1/2 + 1/4 + 1/10 + 1/12 + 1/15 = 1 (#1)
• 1/2 + 1/4 + 1/9 + 1/12 + 1/18 = 1 (#2)
• 1/2 + 1/5 + 1/6 + 1/12 + 1/20 = 1 (#3)
• 1/3 + 1/4 + 1/5 + 1/6 + 1/20 = 1 (#4)
• 1/2 + 1/4 + 1/8 + 1/12 + 1/24 = 1 (#5)
• 1/2 + 1/3 + 1/12 + 1/21 + 1/28 = 1 (#6)
• 1/2 + 1/4 + 1/6 + 1/21 + 1/28 = 1 (#7)
• 1/2 + 1/4 + 1/7 + 1/14 + 1/28 = 1 (#8)
• 1/2 + 1/3 + 1/12 + 1/20 + 1/30 = 1 (#9)
• 1/2 + 1/4 + 1/6 + 1/20 + 1/30 = 1 (#10)
• 1/2 + 1/5 + 1/6 + 1/10 + 1/30 = 1 (#11)
• 1/2 + 1/3 + 1/11 + 1/22 + 1/33 = 1 (#12)
• 1/2 + 1/3 + 1/14 + 1/15 + 1/35 = 1 (#13)
• 1/2 + 1/3 + 1/12 + 1/18 + 1/36 = 1 (#14)
• 1/2 + 1/4 + 1/6 + 1/18 + 1/36 = 1 (#15)
• 1/2 + 1/3 + 1/10 + 1/24 + 1/40 = 1 (#16)
• 1/2 + 1/4 + 1/8 + 1/10 + 1/40 = 1 (#17)
• 1/2 + 1/4 + 1/7 + 1/12 + 1/42 = 1 (#18)
• 1/2 + 1/3 + 1/9 + 1/30 + 1/45 = 1 (#19)
• 1/2 + 1/4 + 1/5 + 1/36 + 1/45 = 1 (#20)
• 1/2 + 1/5 + 1/6 + 1/9 + 1/45 = 1 (#21)
• 1/2 + 1/3 + 1/12 + 1/16 + 1/48 = 1 (#22)
• 1/2 + 1/4 + 1/6 + 1/16 + 1/48 = 1 (#23)
• 1/2 + 1/3 + 1/9 + 1/27 + 1/54 = 1 (#24)
• 1/2 + 1/3 + 1/8 + 1/42 + 1/56 = 1 (#25)
• 1/2 + 1/3 + 1/8 + 1/40 + 1/60 = 1 (#26)
• 1/2 + 1/3 + 1/10 + 1/20 + 1/60 = 1 (#27)
• 1/2 + 1/3 + 1/12 + 1/15 + 1/60 = 1 (#28)
• 1/2 + 1/4 + 1/5 + 1/30 + 1/60 = 1 (#29)
• 1/2 + 1/4 + 1/6 + 1/15 + 1/60 = 1 (#30)
• 1/2 + 1/4 + 1/5 + 1/28 + 1/70 = 1 (#31)
• 1/2 + 1/3 + 1/8 + 1/36 + 1/72 = 1 (#32)
• 1/2 + 1/3 + 1/9 + 1/24 + 1/72 = 1 (#33)
• 1/2 + 1/4 + 1/8 + 1/9 + 1/72 = 1 (#34)
• 1/2 + 1/3 + 1/12 + 1/14 + 1/84 = 1 (#35)
• 1/2 + 1/4 + 1/6 + 1/14 + 1/84 = 1 (#36)
• 1/2 + 1/3 + 1/8 + 1/33 + 1/88 = 1 (#37)
• 1/2 + 1/3 + 1/10 + 1/18 + 1/90 = 1 (#38)
• 1/2 + 1/3 + 1/7 + 1/78 + 1/91 = 1 (#39)
• 1/2 + 1/3 + 1/8 + 1/32 + 1/96 = 1 (#40)
• 1/2 + 1/3 + 1/9 + 1/22 + 1/99 = 1 (#41)
• 1/2 + 1/4 + 1/5 + 1/25 + 1/100 = 1 (#42)
• 1/2 + 1/3 + 1/7 + 1/70 + 1/105 = 1 (#43)
• 1/2 + 1/3 + 1/11 + 1/15 + 1/110 = 1 (#44)
• 1/2 + 1/3 + 1/8 + 1/30 + 1/120 = 1 (#45)
• 1/2 + 1/4 + 1/5 + 1/24 + 1/120 = 1 (#46)
• 1/2 + 1/5 + 1/6 + 1/8 + 1/120 = 1 (#47)
• 1/2 + 1/3 + 1/7 + 1/63 + 1/126 = 1 (#48)
• 1/2 + 1/3 + 1/9 + 1/21 + 1/126 = 1 (#49)
• 1/2 + 1/3 + 1/7 + 1/60 + 1/140 = 1 (#50)
• 1/2 + 1/4 + 1/7 + 1/10 + 1/140 = 1 (#51)
• 1/2 + 1/3 + 1/12 + 1/13 + 1/156 = 1 (#52)
• 1/2 + 1/4 + 1/6 + 1/13 + 1/156 = 1 (#53)
• 1/2 + 1/3 + 1/7 + 1/56 + 1/168 = 1 (#54)
• 1/2 + 1/3 + 1/8 + 1/28 + 1/168 = 1 (#55)
• 1/2 + 1/3 + 1/9 + 1/20 + 1/180 = 1 (#56)
• 1/2 + 1/3 + 1/7 + 1/54 + 1/189 = 1 (#57)
• 1/2 + 1/3 + 1/8 + 1/27 + 1/216 = 1 (#58)
• 1/2 + 1/4 + 1/5 + 1/22 + 1/220 = 1 (#59)
• 1/2 + 1/3 + 1/11 + 1/14 + 1/231 = 1 (#60)
• 1/2 + 1/3 + 1/7 + 1/51 + 1/238 = 1 (#61)
• 1/2 + 1/3 + 1/10 + 1/16 + 1/240 = 1 (#62)
• 1/2 + 1/3 + 1/7 + 1/49 + 1/294 = 1 (#63)
• 1/2 + 1/3 + 1/8 + 1/26 + 1/312 = 1 (#64)
• 1/2 + 1/3 + 1/7 + 1/48 + 1/336 = 1 (#65)
• 1/2 + 1/3 + 1/9 + 1/19 + 1/342 = 1 (#66)
• 1/2 + 1/4 + 1/5 + 1/21 + 1/420 = 1 (#67)
• 1/2 + 1/3 + 1/7 + 1/46 + 1/483 = 1 (#68)
• 1/2 + 1/3 + 1/8 + 1/25 + 1/600 = 1 (#69)
• 1/2 + 1/3 + 1/7 + 1/45 + 1/630 = 1 (#70)
• 1/2 + 1/3 + 1/7 + 1/44 + 1/924 = 1 (#71)
• 1/2 + 1/3 + 1/7 + 1/43 + 1/1806 = 1 (#72)

• 1/2 + 1/5 + 1/6 + 1/12 + 1/20 = 1 (#3)
• 1/3 + 1/4 + 1/5 + 1/6 + 1/20 = 1 (#4)

Here are the solutions in another format:

(2,4,10,12,15), (2,4,9,12,18), (2,5,6,12,20), (3,4,5,6,20), (2,4,8,12,24), (2,3,12,21,28), (2,4,6,21,28), (2,4,7,14,28), (2,3,12,20,30), (2,4,6,20,30), (2,5,6,10,30), (2,3,11,22,33), (2,3,14,15,35), (2,3,12,18,36), (2,4,6,18,36), (2,3,10,24,40), (2,4,8,10,40), (2,4,7,12,42), (2,3,9,30,45), (2,4,5,36,45), (2,5,6,9,45), (2,3,12,16,48), (2,4,6,16,48), (2,3,9,27,54), (2,3,8,42,56), (2,3,8,40,60), (2,3,10,20,60), (2,3,12,15,60), (2,4,5,30,60), (2,4,6,15,60), (2,4,5,28,70), (2,3,8,36,72), (2,3,9,24,72), (2,4,8,9,72), (2,3,12,14,84), (2,4,6,14,84), (2,3,8,33,88), (2,3,10,18,90), (2,3,7,78,91), (2,3,8,32,96), (2,3,9,22,99), (2,4,5,25,100), (2,3,7,70,105), (2,3,11,15,110), (2,3,8,30,120), (2,4,5,24,120), (2,5,6,8,120), (2,3,7,63,126), (2,3,9,21,126), (2,3,7,60,140), (2,4,7,10,140), (2,3,12,13,156), (2,4,6,13,156), (2,3,7,56,168), (2,3,8,28,168), (2,3,9,20,180), (2,3,7,54,189), (2,3,8,27,216), (2,4,5,22,220), (2,3,11,14,231), (2,3,7,51,238), (2,3,10,16,240), (2,3,7,49,294), (2,3,8,26,312), (2,3,7,48,336), (2,3,9,19,342), (2,4,5,21,420), (2,3,7,46,483), (2,3,8,25,600), (2,3,7,45,630), (2,3,7,44,924), (2,3,7,43,1806)

Note

Strictly speaking, there are two solutions for n = 2 in genuine Egyptian fractions, because 1/3 + 2/3 = 1 and 1/4 + 3/4 = 1. As noted above, 2/3 and 3/4 were permitted as fractions in ancient Egypt.

# Can You Dij It? #2

It’s very simple, but I’m fascinated by it. I’m talking about something I call the digit-line, or the stream of digits you get when you split numbers in a particular base into individual digits. For example, here are the numbers one to ten in bases 2 and 3:

Base = 2: 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010…
Base = 3: 1, 2, 10, 11, 12, 20, 21, 22, 100, 101…

If you turn them into digit-lines, they look like this:

Base = 2: 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0… (A030190 in the Online Encyclopedia of Integer Sequences)
Base = 3: 1, 2, 1, 0, 1, 1, 1, 2, 2, 0, 2, 1, 2, 2, 1, 0, 0, 1, 0, 1… (A003137 in the OEIS)

At the tenth digit of the two digit-lines, both digits equal zero for the first time:

Base = 2: 1, 1, 0, 1, 1, 1, 0, 0, 1, 0
Base = 3: 1, 2, 1, 0, 1, 1, 1, 2, 2, 0

When the binary and ternary digits are represented together, the digit-lines look like this:

(1,1), (1,2), (0,1), (1,0), (1,1), (1,1), (0,1), (0,2), (1,2), (0,0)

But in base 4, the tenth digit of the digit-line is 1. So when do all the digits of the digit-line first equal zero for bases 2 to 4? Here the early integers in those bases:

Base 2: 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111, 10000, 10001, 10010, 10011, 10100, 10101…

Base 3: 1, 2, 10, 11, 12, 20, 21, 22, 100, 101, 102, 110, 111, 112, 120, 121, 122, 200, 201, 202, 210, 211, 212, 220, 221, 222, 1000, 1001, 1002…

Base 4: 1, 2, 3, 10, 11, 12, 13, 20, 21, 22, 23, 30, 31, 32, 33, 100, 101, 102, 103, 110, 111, 112, 113, 120, 121, 122, 123, 130, 131, 132, 133, 200…

And here are the digits of the digit-line in bases 2 to 4 represented together:

(1,1,1), (1,2,2), (0,1,3), (1,0,1), (1,1,0), (1,1,1), (0,1,1), (0,2,1), (1,2,2), (0,0,1), (1,2,3), (1,1,2), (1,2,0), (0,2,2), (1,1,1), (1,0,2), (1,0,2), (1,1,2), (0,0,3), (0,1,3), (0,1,0), (1,0,3), (0,2,1), (0,1,3), (1,1,2), (1,0,3), (0,1,3), (1,1,1), (0,1,0), (1,1,0), (0,1,1), (1,2,0), (1,1,1), (1,2,1), (1,0,0), (0,1,2), (0,2,1), (1,1,0), (1,1,3), (0,2,1), (1,2,1), (1,2,0), (1,0,1), (1,0,1), (0,2,1), (1,0,1), (1,1,1), (1,2,2), (1,0,1), (1,2,1), (0,2,3), (0,1,1), (0,0,2), (0,2,0), (1,1,1), (0,1,2), (0,2,1), (0,1,1), (1,2,2), (1,2,2), (0,2,1), (0,0,2), (1,2,3), (0,2,1), (1,1,3), (0,2,0), (0,2,1), (1,2,3), (1,1,1), (1,0,1), (0,0,3), (1,0,2), (0,1,1), (0,0,3), (1,0,3), (0,1,2), (1,1,0), (0,0,0)

At the 78th digit, all three digits equal zero. But the 78th digit of the digit-line in base 5 is 1. So when are the digits first equal to zero in bases 2 to 5? It’s not difficult to find out, but the difficulty of the search increases fast as the bases get bigger. Here are the results up to base 13 (note that bases 11 and 12 both have zeroes at digit 103721663):

dig=0 in bases 2 to 3 at the 10th digit of the digit-line
dig=0 in bases 2 to 4 at the 78th digit of the digit-line
dig=0 in bases 2 to 5 at the 182nd digit of the digit-line
dig=0 in bases 2 to 6 at the 302nd digit of the digit-line
dig=0 in bases 2 to 7 at the 12149th digit of the digit-line
dig=0 in bases 2 to 8 at the 45243rd digit of the digit-line
dig=0 in bases 2 to 9 at the 255261st digit of the digit-line
dig=0 in bases 2 to 10 at the 8850623rd digit of the digit-line
dig=0 in bases 2 to 12 at the 103721663rd digit of the digit-line
dig=0 in bases 2 to 13 at the 807778264th digit of the digit-line

I assume that, for any base b > 2, you can find some point in the digit-line at which d = 0 for all bases 2 to b. Indeed, I assume that this happens infinitely often. But I don’t know any short-cut for finding the first digit at which this occurs.

Previously pre-posted:

# Can You Dij It? #1

The most powerful drug in the world is water. The second most powerful is language. But everyone’s on them, so nobody realizes how powerful they are. Well, you could stop drinking water. Then you’d soon realize its hold on the body and the brain.

But you can’t stop using language. Try it. No, the best way to realize the power of language is to learn a new one. Each is a feast with different flavours. New alphabets are good too. The Devanagari alphabet is one of the strongest, but if you want it in refined form, try the phonetic alphabet. It will transform the way you see the world. That’s because it will make you conscious of what you’re already subconsciously aware of.

But “language” is a bigger category that it used to be. Nowadays we have computer languages too. Learning one is another way of transforming the way you see the world. And like natural languages – French, Georgian, Tagalog – they come in different flavours. Pascal is not like Basic is not like C is not like Prolog. But all of them seem to put you in touch with some deeper aspect of reality. Computer languages are like mathemagick: a way to give commands to something immaterial and alter the world by the application of will.

That feeling is at its strongest when you program with machine code, the raw instructions used by the electronics of a computer. At its most fundamental, machine code is simply a series of binary numbers controlling how a computer processes other binary numbers. You can memorize and use those code-numbers, but it’s easier to use something like assembly language, which makes machine-code friendlier for human beings. But it still looks very odd to the uninitiated:

setupnum:
xor ax,ax
xor bp,bp
mov cx,20
clearloop:
mov [di+bp],ax
loop clearloop
ret

That’s almost at the binary bedrock. And machine code is fast. If a fast higher-level language like C feels like flying a Messerschmitt 262, which was a jet-plane, machine-code feels like flying a Messerschmitt 163, which was a rocket-plane. A very fast and very dangerous rocket-plane.

I’m not good at programming languages, least of all machine code, but they are fun to use, quite apart from the way they make you feel as though you’re in touch with a deeper aspect of reality. They do that because the world is mathematics at its most fundamental level, I think, and computer languages are a form of mathematics.

Their mathematical nature is disguised in a lot of what they’re used for, but I like to use them for recreational mathematics. Machine-code is useful when you need a lot of power and speed. For example, look at these digits:

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

They’re what the Online Encyclopedia of Integer Sequences (OEIS) calls “the almost natural numbers” (sequence A007376) and you generate them by writing the standard integers – 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13… – and then separating each digit with a comma: 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 0, 1, 1, 1, 2, 1, 3… The commas give them some interesting twists. In a list of the standard integers, the 1st entry is 1, the 10th entry is 10, the 213rd entry is 213, the 987,009,381th entry is 987,009,381, and so on.

But that doesn’t work with the almost natural numbers. The 10th entry is 1, not 10, and the 11th entry is 0, not 11. But the 10th entry does begin the sequence (1, 0). I wondered whether that happened again. It does. The 63rd entry in the almost natural numbers begins the sequence (6, 3) – see the asterisks in the sequence above.

This happens again at the 3105th entry, which begins the sequence (3, 1, 0, 5). After that the gaps get bigger, which is where machine code comes in. An ordinary computer-language takes a long time to reach the 89,012,345,679th entry in the almost natural numbers. Machine code is much quicker, which is why I know that the 89,012,345,679th entry begins the sequence (8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 9):

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 63, 3105, 43108, 77781, 367573, 13859021, 77911127, 911360799, 35924813703, 74075186297, 89012345679…

And an ordinary computer-language might give you the impression that base 9 doesn’t have numbers like these (apart from the trivial 1, 2, 3, 4, 5, 6, 7, 8, 10…). But it does. 63 in base 10 is a low-hanging fruit: you could find it working by hand. In base 9, the fruit are much higher-hanging. But machine code plucks them with almost ridiculous ease:

1, 2, 3, 4, 5, 6, 7, 8, 10, 570086565, 655267526, 2615038272, 4581347024, 5307541865, 7273850617, 7801234568…
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}