# Spiral Artefact

What’s the next number in this sequence of integers?

5, 14, 19, 23, 28, 32, 37, 41, 46, 50, 55... (A227793 at the OEIS)

It shouldn’t be hard to work out that it’s 64 — the sum-of-digits of n is divisible by 5, i.e., digsum(n) mod 5 = 0. Now try summing the numbers in that sequence:

5 + 14 = 19
19 + 19 = 38
38 + 23 = 61
61 + 28 = 89
89 + 32 = 121
121 + 37 = 158
158 + 41 = 199
199 + 46 = 245
[...]

Here are the cumulative sums as another sequence:

5, 19, 38, 61, 89, 121, 158, 199, 245, 295, 350, 414, 483, 556, 634, 716, 803, 894, 990, 1094, 1203, 1316, 1434, 1556, 1683, 1814, 1950, 2090, 2235, 2389, 2548, 2711, 2879, 3051, 3228, 3409, 3595, 3785, 3980, 4183, 4391, 4603, 4820, 5041, 5267, 5497, 5732, 5976, 6225...

And there’s that cumulative-sum sequence represented as a spiral:

Spiral for cumulative sum of n where digsum(n) mod 5 = 0

You can see how the spiral is created by following 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E… from the center:

ZYXWVU
GFEDCT
H432BS
I501AR
J6789Q
KLMNOP

What about other values for the cumulative sums of digsum(n) mod m = 0? Here’s m = 2,3,4,5,6,7:

Spiral for cumulative sum of n where digsum(n) mod 2 = 0
s1 = 2, 4, 6, 8, 11, 13, 15, 17, 19, 20, 22…
s2 = 2, 6, 12, 20, 31, 44, 59, 76, 95, 115… (cumulative sum of s1)

sum of digsum(n) mod 3 = 0
s1 = 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33…
s2 = 3, 9, 18, 30, 45, 63, 84, 108, 135, 165…

sum of digsum(n) mod 4 = 0
s1 = 4, 8, 13, 17, 22, 26, 31, 35, 39, 40, 44…
s2 = 4, 12, 25, 42, 64, 90, 121, 156, 195, 235…

sum of digsum(n) mod 5 = 0
s1 = 5, 14, 19, 23, 28, 32, 37, 41, 46, 50, 55…
s2 = 5, 19, 38, 61, 89, 121, 158, 199, 245, 295…

sum of digsum(n) mod 6 = 0
s1 = 6, 15, 24, 33, 39, 42, 48, 51, 57, 60, 66…
s2 = 6, 21, 45, 78, 117, 159, 207, 258, 315, 375…

sum of digsum(n) mod 7 = 0
s1 = 7, 16, 25, 34, 43, 52, 59, 61, 68, 70, 77…
s2 = 7, 23, 48, 82, 125, 177, 236, 297, 365, 435…

The spiral for m = 2 is strange, but the spirals are similar after that. Until m = 8, when something strange happens again:

sum of digsum(n) mod 8 = 0
s1 = 8, 17, 26, 35, 44, 53, 62, 71, 79, 80, 88…
s2 = 8, 25, 51, 86, 130, 183, 245, 316, 395, 475…

sum of digsum(n) mod 9 = 0
s1 = 9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99…
s2 = 9, 27, 54, 90, 135, 189, 252, 324, 405, 495…

sum of digsum(n) mod 10 = 0
s1 = 19, 28, 37, 46, 55, 64, 73, 82, 91, 109, 118…
s2 = 19, 47, 84, 130, 185, 249, 322, 404, 495, 604…

Here’s an animated gif of m = 8 at higher and higher resolution:

sum of digsum(n) mod 8 = 0 (animated gif)

You might think this strange behavior is dependant on the base in which the dig-sum is calculated. It isn’t. Here’s an animated gif for other bases in which the mod-8 spiral behaves strangely:

sum of digsum(n) mod 8 = 0 in base b = 5, 6, 7, 9, 11, 12, 13 (animated gif)

But the mod-8 spiral stops behaving strangely when the spiral is like this, as a diamond:

W
XIV
YJ8HU
ZK927GT
LA3016FS
MB45ER
NCDQ
OP

Now the mod-8 spiral looks like this:

sum of digsum(n) mod 8 = 0 (diamond spiral)

But the mod-4 and mod-9 spirals look like this:

sum of digsum(n) mod 4 = 0 (diamond spiral)

sum of digsum(n) mod 9 = 0 (diamond spiral)

You can also construct the spirals as a triangle, like this:

U
VCT
WD2CS
XE301AR
YF456789Q
ZGHIJKLMNOP

Here’s the beginning of the mod-5 triangular spiral:

sum of digsum(n) mod 5 = 0 (triangular spiral) (open in new window for full size)

And the beginning of the mod-8 triangular spiral:

sum of digsum(n) mod 8 = 0 (triangular spiral) (open in new window for full size)

The mod-8 spiral is behaving strangely again. So the strangeness is partly an artefact of the way the spirals are constructed.

Post-Performative Post-Scriptum

“Spiral Artefact”, the title of this incendiary intervention, is of course a tip-of-the-hat to core Black-Sabbath track “Spiral Architect”, off core Black-Sabbath album Sabbath Bloody Sabbath, issued in core Black-Sabbath success-period of 1973.

# 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)

# 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.

# 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

# T4K1NG S3LF13S

It’s like watching a seed grow. You take a number and count how many 0s it contains, then how many 1s, how many 2s, 3s, 4s and so on. Then you create a new number by writing the count of each digit followed by the digit itself. Then you repeat the process with the new number.

1

The count of digits is one 1, so the new number is this:

→ 11

The count of digits for 11 is two 1s, so the next number is:

→ 21

The count of digits for 21 is one 1, one 2, so the next number is:

→ 1112

The count of digits for 1112 is three 1s, one 2, so the next number is:

→ 3112

The count of digits for 3112 is two 1s, one 2, one 3, so the next number is:

→ 211213

What happens after that? Here are the numbers as a sequence:

1 → 11 → 21 → 1112 → 3112 → 211213 → 312213 → 212223 → 114213 → 31121314 → 41122314 → 31221324 → 21322314

That’s all you need, because something interesting happens with 21322314. The digit count is two 1s, three 2s, two 3s, one 4, so the next number is:

→ 21322314

In other words, 21322314 is what might be called a self-descriptive number: it describes the count of its own digits. That’s why I think this procedure is like watching a seed grow. You start with the tiny seed of 1 and end in the giant oak of 21322314, whose factorization is 2 * 3^2 * 13 * 91121. But there are many more self-descriptive numbers in base ten and some of them are much bigger than 21322314. A047841 at the Online Encyclopedia of Integer Sequences lists all 109 of them (and calls them “autobiographical numbers”). Here are a few, starting with the simplest possible:

22 → two 2s → 22
10213223 → one 0, two 1s, three 2s, two 3s → 10213223
10311233 → one 0, three 1s, one 2, three 3s → 10311233
21322314 → two 1s, three 2s, two 3s, one 4 → 21322314
21322315 → two 1s, three 2s, two 3s, one 5 → 21322315
21322316 → two 1s, three 2s, two 3s, one 6 → 21322316*
1031223314 → one 0, three 1s, two 2s, three 3s, one 4 → 10
31223314
3122331415 → three 1s, two 2s, three 3s, one 4, one 5
→ 3122331415
3122331416 → three 1s, two 2s, three 3s, one 4, one 6
→ 3122331416*

*And for 21322317, 21322318, 21322319; 3122331417, 3122331418, 3122331419.

And here’s what happens when you seed a sequence with a number containing all possible digits in base ten:

1234567890 → 10111213141516171819 → 101111213141516171819 → 101211213141516171819 → 101112213141516171819

That final number is self-descriptive:

101112213141516171819 → one 0, eleven 1s, two 2s, one 3, one 4, one 5, one 6, one 7, one 8, one 9 → 101112213141516171819

So some numbers are self-descriptive and some start a sequence that ends in a self-descriptive number. But that doesn’t exhaust the possibilities. Some numbers are part of a loop:

103142132415 → 104122232415 → 103142132415
104122232415 → 103142132415 → 104122232415
1051421314152619 → 1061221324251619 → 1051421314152619…
5142131415261819 → 6122132425161819 → 5142131415261819
106142131416271819 → 107122132426171819 → 106142131416271819

10512223142518 → 10414213142518 → 10512213341518 → 10512223142518
51222314251718 → 41421314251718 → 51221334151718 →
51222314251718

But all that is base ten. What about other bases? In fact, nearly all self-descriptive numbers in base ten are also self-descriptive in other bases. An infinite number of other bases, in fact. 22 is a self-descriptive number for all b > 2. The sequence seeded with 1 is identical in all b > 4:

1 → 11 → 21 → 1112 → 3112 → 211213 → 312213 → 212223 → 114213 → 31121314 → 41122314 → 31221324 → 2132231421322314

In bases 2, 3 and 4, the sequence seeded with 1 looks like this:

1 → 11 → 101 → 10101 → 100111 → 1001001 → 1000111 → 11010011101001… (b=2) (1101001[2] = 105 in base 10)
1 → 11 → 21 → 1112 → 10112 → 1010112 → 2011112 → 10111221011122… (b=3) (1011122[3] = 854 in base 10)
1 → 11 → 21 → 1112 → 3112 → 211213 → 312213 → 212223 → 1110213 → 101011213 → 201111213 → 101112213101112213… (b=4) (101112213[4] = 71079 in base 10)

In base 2 there are only two self-descriptive numbers (and no loops):

111 → three 1s → 111… (b=2) (111 = 7 in base 10)
1101001 → three 0s, four 1s → 1101001… (b=2) (1101001 = 105 in base 10)

So if you apply the “count digits” procedure in base 2, all numbers, except 111, begin a sequence that ends in 1101001. Base 3 has a few more self-descriptive numbers and also some loops:

2222… (b >= 3)
10111 → one 0, four 1s → 10111… (b=3)
11112 → four 1s, one 2 → 11112
100101 → three 0s, three 1s → 100101… (b=3)
1011122 → one 0, four 1s, two 2s → 1011122… (b=3)
2021102 → two 0s, two 1s, three 2s → 2021102… (b=3)
10010122 → three 0s, three 1s, two 2s → 10010122

2012112 → 10101102 → 10011112 → 2012112
10011112 → 2012112 → 10101102 → 10011112
10101102 → 10011112 → 2012112 → 10101102

A question I haven’t been able to answer: Is there a base in which loops can be longer than these?

103142132415 → 104122232415 → 103142132415
10512223142518 → 10414213142518 → 10512213341518 → 10512223142518

A question I have been able to answer: What is the sequence when it’s seeded with the title of this blog-post? T4K1NGS3LF13S is a number in all bases >= 30 and its base-30 form equals 15,494,492,743,722,316,018 in base 10 (with the factorization 2 * 72704927 * 106557377767). If T4K1NGS3LF13S seeds a sequence in any b >= 30, the result looks like this:

T4K1NGS3LF13S → 2123141F1G1K1L1N2S1T → 813213141F1G1K1L1N1S1T → A1122314181F1G1K1L1N1S1T → B1221314181A1F1G1K1L1N1S1T → C1221314181A1B1F1G1K1L1N1S1T → D1221314181A1B1C1F1G1K1L1N1S1T → E1221314181A1B1C1D1F1G1K1L1N1S1T → F1221314181A1B1C1D1E1F1G1K1L1N1S1T → G1221314181A1B1C1D1E2F1G1K1L1N1S1T → F1321314181A1B1C1D1E1F2G1K1L1N1S1T → F1222314181A1B1C1D1E2F1G1K1L1N1S1T → E1421314181A1B1C1D1E2F1G1K1L1N1S1T → F1221324181A1B1C1D2E1F1G1K1L1N1S1T → E1421314181A1B1C1D1E2F1G1K1L1N1S1T

# 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:

# For Revver and Fevver

This shape reminds me of the feathers on an exotic bird:

(click or open in new window for full size)

(animated version)

The shape is created by reversing the digits of a number, so you could say it involves revvers and fevvers. I discovered it when I was looking at the Halton sequence. It’s a sequence of fractions created according to a simple but interesting rule. The rule works like this: take n in base b, reverse it, and divide reverse(n) by the first power of b that is greater thann.

For example, suppose n = 6 and b = 2. In base 2, 6 = 110 and reverse(110) = 011 = 11 = 3. The first power of 2 that is greater than 6 is 2^3 or 8. Therefore, halton(6) in base 2 equals 3/8. Here is the same procedure applied to n = 1..20:

1: halton(1) = 1/10[2] → 1/2
2: halton(10) = 01/100[2] → 1/4
3: halton(11) = 11/100[2] → 3/4
4: halton(100) = 001/1000[2] → 1/8
5: halton(101) = 101/1000[2] → 5/8
6: halton(110) = 011/1000 → 3/8
7: halton(111) = 111/1000 → 7/8
8: halton(1000) = 0001/10000 → 1/16
9: halton(1001) = 1001/10000 → 9/16
10: halton(1010) = 0101/10000 → 5/16
11: halton(1011) = 1101/10000 → 13/16
12: halton(1100) = 0011/10000 → 3/16
13: halton(1101) = 1011/10000 → 11/16
14: halton(1110) = 0111/10000 → 7/16
15: halton(1111) = 1111/10000 → 15/16
16: halton(10000) = 00001/100000 → 1/32
17: halton(10001) = 10001/100000 → 17/32
18: halton(10010) = 01001/100000 → 9/32
19: halton(10011) = 11001/100000 → 25/32
20: halton(10100) = 00101/100000 → 5/32…

Note that the sequence always produces reduced fractions, i.e. fractions in their lowest possible terms. Once 1/2 has appeared, there is no 2/4, 4/8, 8/16…; once 3/4 has appeared, there is no 6/8, 12/16, 24/32…; and so on. If the fractions are represented as points in the interval [0,1], they look like this:

point = 1/2

point = 1/4

point = 3/4

point = 1/8

point = 5/8

point = 3/8

point = 7/8

(animated line for base = 2, n = 1..63)

It’s apparent that Halton points in base 2 will evenly fill the interval [0,1]. Now compare a Halton sequence in base 3:

1: halton(1) = 1/10[3] → 1/3
2: halton(2) = 2/10[3] → 2/3
3: halton(10) = 01/100[3] → 1/9
4: halton(11) = 11/100[3] → 4/9
5: halton(12) = 21/100[3] → 7/9
6: halton(20) = 02/100 → 2/9
7: halton(21) = 12/100 → 5/9
8: halton(22) = 22/100 → 8/9
9: halton(100) = 001/1000 → 1/27
10: halton(101) = 101/1000 → 10/27
11: halton(102) = 201/1000 → 19/27
12: halton(110) = 011/1000 → 4/27
13: halton(111) = 111/1000 → 13/27
14: halton(112) = 211/1000 → 22/27
15: halton(120) = 021/1000 → 7/27
16: halton(121) = 121/1000 → 16/27
17: halton(122) = 221/1000 → 25/27
18: halton(200) = 002/1000 → 2/27
19: halton(201) = 102/1000 → 11/27
20: halton(202) = 202/1000 → 20/27
21: halton(210) = 012/1000 → 5/27
22: halton(211) = 112/1000 → 14/27
23: halton(212) = 212/1000 → 23/27
24: halton(220) = 022/1000 → 8/27
25: halton(221) = 122/1000 → 17/27
26: halton(222) = 222/1000 → 26/27
27: halton(1000) = 0001/10000 → 1/81
28: halton(1001) = 1001/10000 → 28/81
29: halton(1002) = 2001/10000 → 55/81
30: halton(1010) = 0101/10000 → 10/81

And here is an animated gif representing the Halton sequence in base 3 as points in the interval [0,1]:

Halton points in base 3 also evenly fill the interval [0,1]. What happens if you apply the Halton sequence to a two-dimensional square rather a one-dimensional line? Suppose the bottom left-hand corner of the square has the co-ordinates (0,0) and the top right-hand corner has the co-ordinates (1,1). Find points (x,y) inside the square, with x supplied by the Halton sequence in base 2 and y supplied by the Halton sequence in base 3. The square will gradually fill like this:

x = 1/2, y = 1/3

x = 1/4, y = 2/3

x = 3/4, y = 1/9

x = 1/8, y = 4/9

x = 5/8, y = 7/9

x = 3/8, y = 2/9

x = 7/8, y = 5/9

x = 1/16, y = 8/9

x = 9/16, y = 1/27…

animated square

Read full page: For Revver and Fevver

# Performativizing the Polygonic

Maths is a mountain: you can start climbing in different places and reach the same destination. There are many ways of proving the irrationality of √2 or the infinitude of the primes, for example. But you can also arrive at the same destination by accident. I’ve found that when I use different methods of creating fractals. The same fractals appear, because apparently different algorithms are actually the same underneath.

But different methods can create unique fractals too. I’ve found some new ones by using what might be called point-to-point recursion. For example, there are ten ways to select three vertices from the five vertices of a pentagon: (1, 2, 3), (1, 2, 4), (1, 2, 5), (1, 3, 4), (1, 3, 5), (1, 4, 5), (2, 3, 4), (2, 3, 5), (2, 4, 5), (3, 4, 5). Find the midpoint of the first three-point set, (1, 2, 3). Then select two vertices to go with this midpoint, creating a new three-point set, and find the midpoint again. And so on. The process looks like this, with the midpoints shown for all the three-point sets found at each stage:

vertices = 5, choose sets of 3 points, find mid-point of each

At stage 5, the fractal looks like this:

v = 5, p = 3

Note that when pixels are used again, the colour changes. That’s another interesting thing about maths: limits can sometimes produce deeper results. If these fractals were drawn at very high resolution, pixels would only be used once and the colour would never change. As it is, low resolution means that pixels are used again and again. But some are used more than others, which is why interesting colour effects appear.

If the formation of the fractal is animated, it looks like this (with close-ups of even deeper stages):

Here are some more examples:

v = 4 + central point, p = 2 (cf. Fingering the Frigit)

v = 4c, p = 2 (animated)

v = 4, p = 3

v = 5, p = 4

v = 5 + central point, p = 3

v = 5c, p = 4

v = 5c, p = 5

v = 6 + 1 point between each pair of vertices, p = 6

v = 6, p = 2

v = 6, p = 3

v = 6, p = 4

v = 6c, p = 2 (cf. Fingering the Frigit)

v = 6c, p = 3

v = 6c, p = 4

v = 7, p = 3

v = 7, p = 4

v = ,7 p = 5

v = 7c, p = 4

v = 3+1, p = 2

v = 3+1, p = 3

v = 3+1, p = 4

v = 3+2, p = 5

v = 3c+1, p = 2

v = 3c+1, p = 4

v = 3c, p = 2

v = 3c, p = 3

v = 4+1, p = 3

v = 4+1, p = 4

v = 4+1, p = 6

v = 4+1, p = 2

v = 4c+1, p = 4

v = 4c, p = 3

v = 5+1, p = 4 (and more)

v = 5, p = 2

# Digital Rodeo

What a difference a digit makes. Suppose you take all representations of n in bases b <= n. When n = 3, the bases are 2 and 3, so 3 = 11 and 10, respectively. Next, count the occurrences of the digit 1:

digitcount(3, digit=1, n=11, 10) = 3

3 + digitcount(3, digit=1, n=11, 10) = 3 + 3 = 6.

Now apply the same procedure to 6. The bases will be 2 to 6:

6 + digitcount(6, digit=1, n=110, 20, 12, 11, 10) = 6 + 6 = 12

The procedure, n = n + digitcount(n,digit=1,base=2..n), continues like this:

12 + digcount(12,dig=1,n=1100, 110, 30, 22, 20, 15, 14, 13, 12, 11, 10) = 12 + 11 = 23
23 + digcount(23,dig=1,n=10111, 212, 113, 43, 35, 32, 27, 25, 23, 21, 1B, 1A, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10) = 23 + 21 = 44
44 + digcount(44,dig=1,n=101100, 1122, 230, 134, 112, 62, 54, 48, 44, 40, 38, 35, 32, 2E, 2C, 2A, 28, 26, 24, 22, 20, 1L, 1K, 1J, 1I, 1H, 1G, 1F, 1E, 1D, 1C, 1B, 1A, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10) = 44 + 31 = 75

And the sequence develops like this:

3, 6, 12, 23, 44, 75, 124, 202, 319, 503, 780, 1196, 1824, 2766, 4191, 6338, 9546, 14383, 21656, 32562, 48930, 73494, 110361, 165714, 248733, 373303, 560214, 840602, 1261237, 1892269, 2838926, 4258966, 6389157, 9584585, 14377879…

Now try the same procedure using the digit 0: n = n + digcount(n,dig=0,base=2..n). The first step is this:

3 + digcount(3,digit=0,n=11, 10) = 3 + 1 = 4

Next come these:

4 + digcount(4,dig=0,n=100, 11, 10) = 4 + 3 = 7
7 + digcount(7,dig=0,n=111, 21, 13, 12, 11, 10) = 7 + 1 = 8
8 + digcount(8,dig=0,n=1000, 22, 20, 13, 12, 11, 10) = 8 + 5 = 13
13 + digcount(13,dig=0,n=1101, 111, 31, 23, 21, 16, 15, 14, 13, 12, 11, 10) = 13 + 2 = 15
15 + digcount(15,dig=0,n=1111, 120, 33, 30, 23, 21, 17, 16, 15, 14, 13, 12, 11, 10) = 15 + 3 = 18
18 + digcount(18,dig=0,n=10010, 200, 102, 33, 30, 24, 22, 20, 18, 17, 16, 15, 14, 13, 12, 11, 10) = 18 + 9 = 27
27 + digcount(27,dig=0,n=11011, 1000, 123, 102, 43, 36, 33, 30, 27, 25, 23, 21, 1D, 1C, 1B, 1A, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10) = 27 + 7 = 34
34 + digcount(34,dig=0,n=100010, 1021, 202, 114, 54, 46, 42, 37, 34, 31, 2A, 28, 26, 24, 22, 20, 1G, 1F, 1E, 1D, 1C, 1B, 1A, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10) = 34 + 8 = 42
42 + digcount(42,dig=0,n=101010, 1120, 222, 132, 110, 60, 52, 46, 42, 39, 36, 33, 30, 2C, 2A, 28, 26, 24, 22, 20, 1K, 1J, 1I, 1H, 1G, 1F, 1E, 1D, 1C, 1B, 1A, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10) = 42 + 9 = 51

The sequence develops like this:

3, 4, 7, 8, 13, 15, 18, 27, 34, 42, 51, 59, 62, 66, 80, 94, 99, 111, 117, 125, 132, 151, 158, 163, 173, 180, 204, 222, 232, 244, 258, 279, 292, 307, 317, 324, 351, 364, 382, 389, 400, 425, 437, 447, 454, 466, 475, 483, 494, 509, 517, 536, 553, 566, 576, 612, 637, 649, 669, 679, 693, 712, 728, 753, 768, 801, 822, 835, 849, 862, 869, 883, 895, 906, 923, 932, 943, 949, 957, 967, 975, 999, 1011…

If you compare it with the sequence for digit=1, it appears that digcount(n,dig=1,b=2..n) is always larger than digcount(n,dig=0,b=2..n). That is in fact the case, with one exception, when n = 2:

digcount(2,dig=1,n=10) = 1
digcount(2,dig=0,n=10) = 1

When n = 10 (in base ten), there are twice as many ones as zeros:

digcount(10,dig=1,n=1010, 101, 22, 20, 14, 13, 12, 11, 10) = 10
digcount(10,dig=0,n=1010, 101, 22, 20, 14, 13, 12, 11, 10) = 5

As n gets larger, the difference grows dramatically:

digcount(100,dig=1,base=2..n) = 64
digcount(100,dig=0,base=2..n) = 16

digcount(1000,dig=1,base=2..n) = 533
digcount(1000,dig=0,base=2..n) = 25

digcount(10000,dig=1,base=2..n) = 5067
digcount(10000,dig=0,base=2..n) = 49

digcount(100000,dig=1,base=2..n) = 50140
digcount(100000,dig=0,base=2..n) = 73

digcount(1000000,dig=1,base=2..n) = 500408
digcount(1000000,dig=0,base=2..n) = 102

digcount(10000000,dig=1,base=2..n) = 5001032
digcount(10000000,dig=0,base=2..n) = 134

digcount(100000000,dig=1,base=2..n) = 50003137
digcount(100000000,dig=0,base=2..n) = 160

In fact, digcount(n,dig=1,b=2..n) is greater than the digit-count for any other digit: 0, 2, 3, 4, 5… (with the exception n = 2, as shown above). But digit=0 sometimes beats digits >= 2. For example, when n = 18:

digcount(18,dig=0,n=10010, 200, 102, 33, 30, 24, 22, 20, 18, 17, 16, 15, 14, 13, 12, 11, 10) = 9
digcount(18,dig=2,n=10010, 200, 102, 33, 30, 24, 22, 20, 18, 17, 16, 15, 14, 13, 12, 11, 10) = 7
digcount(18,dig=3,n=10010, 200, 102, 33, 30, 24, 22, 20, 18, 17, 16, 15, 14, 13, 12, 11, 10) = 4
digcount(18,dig=4,n=10010, 200, 102, 33, 30, 24, 22, 20, 18, 17, 16, 15, 14, 13, 12, 11, 10) = 2
digcount(18,dig=5,n=10010, 200, 102, 33, 30, 24, 22, 20, 18, 17, 16, 15, 14, 13, 12, 11, 10) = 1

But as n gets larger, digcount(0) will fall permanently behind all these digits. However, digcount(0) will always be greater than some digit d, for the obvious reason that some digits only appear when the base is high enough. For example, the hexadecimal digit A (with the decimal value 10) first appears when n = 21:

digcount(21,dig=A,n=10101, 210, 111, 41, 33, 30, 25, 23, 21, 1A, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10) = 1 digcount(21,dig=0,n=10101, 210, 111, 41, 33, 30, 25, 23, 21, 1A, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10) = 5

There is a general rule for the n at which digit d first appears, n = 2d + 1 (this doesn’t apply when d = 0 or d = 1):

d = 2, n = 5 = 2*2 + 1
digcount(5,dig=2,n=101, 12, 11, 10) = 1

d = 3, n = 7 = 2*3 + 1
digcount(7,dig=3,n=111, 21, 13, 12, 11, 10) = 1

d = 4, n = 9 = 2*4 + 1
digcount(9,dig=4,n=1001, 100, 21, 14, 13, 12, 11, 10) = 1

d = 5, n = 11 = 2*5 + 1
digcount(11,dig=5,n=1011, 102, 23, 21, 15, 14, 13, 12, 11, 10) = 1

It should be apparent, then, that the digit-count for a particular digit starts at 1 and gets gradually higher. The rate at which the digit-count increases is highest for 1 and lowest for 0, with digits 2, 3, 4, 5… in between:

Graph for digcount(n,dig=d,b=2..n)

You could think of the graph as a digital rodeo in which these digits compete with each other. 1 is the clear and permanent winner, 0 the gradual loser. Now recall the procedure introduced at the start: n = n + digcount(n,dig=d,b=2..n). When it’s applied to the digits 0 to 5, these are the sequences that appear:

n = n + digcount(n,dig=0,b=2..n)

2, 3, 4, 7, 8, 13, 15, 18, 27, 34, 42, 51, 59, 62, 66, 80, 94, 99, 111, 117, 125, 132, 151, 158, 163, 173, 180, 204, 222, 232, 244, 258, 279, 292, 307, 317, 324, 351, 364, 382, 389, 400, 425, 437, 447, 454, 466, 475, 483, 494, 509, 517, 536, 553, 566, 576, 612, 637, 649, 669, 679, 693, 712, 728, 753, 768, 801, 822, 835, 849, 862, 869, 883, 895, 906, 923, 932, 943, 949, 957, 967, 975, 999, 1011…

n = n + digcount(n,dig=1,b=2..n)

2, 3, 6, 12, 23, 44, 75, 124, 202, 319, 503, 780, 1196, 1824, 2766, 4191, 6338, 9546, 14383, 21656, 32562, 48930, 73494, 110361, 165714, 248733, 373303, 560214, 840602, 1261237, 1892269, 2838926, 4258966, 6389157, 9584585, 14377879…

n = n + digcount(n,dig=2,b=2..n)

5, 6, 8, 12, 16, 22, 31, 37, 48, 60, 76, 94, 115, 138, 173, 213, 257, 311, 374, 454, 542, 664, 790, 935, 1109, 1310, 1552, 1835, 2167, 2548, 2989, 3509, 4120, 4832, 5690, 6687, 7829, 9166, 10727, 12568, 14697, 17182, 20089, 23470, 27425, 32042, 37477, 43768, 51113, 59687, 69705, 81379, 94998, 110910, 129488, 151153, 176429, 205923, 240331, 280490, 327396, 382067, 445858…

n = n + digcount(n,dig=3,b=2..n)

7, 8, 9, 10, 11, 13, 16, 18, 22, 25, 29, 34, 38, 44, 50, 56, 63, 80, 90, 104, 113, 131, 151, 169, 188, 210, 236, 261, 289, 320, 350, 385, 424, 463, 520, 572, 626, 684, 747, 828, 917, 999, 1101, 1210, 1325, 1446, 1577, 1716, 1871, 2040, 2228, 2429, 2642, 2875, 3133, 3413, 3719, 4044, 4402, 4786, 5196, 5645, 6140, 6673, 7257, 7900, 8582, 9315, 10130, 10998, 11942, 12954, 14058…

n = n + digcount(n,dig=4,b=2..n)

9, 10, 11, 12, 13, 14, 16, 18, 20, 23, 25, 28, 34, 41, 44, 52, 61, 67, 74, 85, 92, 102, 113, 121, 134, 148, 170, 184, 208, 229, 253, 269, 287, 306, 324, 356, 386, 410, 439, 469, 501, 531, 565, 604, 662, 703, 742, 794, 845, 895, 953, 1007, 1062, 1127, 1188, 1262, 1336, 1421, 1503, 1585, 1676, 1777, 1876, 2001, 2104, 2249, 2375, 2502, 2636, 2789, 2938, 3102, 3267, 3444, 3644, 3868, 4099…

n = n + digcount(n,dig=5,b=2..n)

11, 12, 13, 14, 15, 16, 17, 19, 21, 23, 26, 28, 29, 33, 37, 41, 48, 50, 55, 60, 64, 67, 72, 75, 83, 91, 96, 102, 107, 118, 123, 129, 137, 151, 159, 171, 180, 192, 202, 211, 224, 233, 251, 268, 280, 296, 310, 324, 338, 355, 380, 401, 430, 455, 488, 511, 536, 562, 584, 607, 638, 664, 692, 718, 748, 778, 807, 838, 874, 911, 951, 993, 1039, 1081, 1124, 1166, 1216, 1264, 1313, 1370, 1432…

# Fingering the Frigit

Fingers are fractal. Where a tree has a trunk, branches and twigs, a human being has a torso, arms and fingers. And human beings move in fractal ways. We use our legs to move large distances, then reach out with our arms over smaller distances, then move our fingers over smaller distances still. We’re fractal beings, inside and out, brains and blood-vessels, fingers and toes.

But fingers are fractal are in another way. A digit – digitus in Latin – is literally a finger, because we once counted on our fingers. And digits behave like fractals. If you look at numbers, you’ll see that they contain patterns that echo each other and, in a sense, recur on smaller and smaller scales. The simplest pattern in base 10 is (0, 1, 2, 3, 4, 5, 6, 7, 8, 9). It occurs again and again at almost very point of a number, like a ten-hour clock that starts at zero-hour:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9…
10, 11, 12, 13, 14, 15, 16, 17, 18, 19…
200… 210… 220… 230… 240… 250… 260… 270… 280… 290…

These fractal patterns become visible if you turn numbers into images. Suppose you set up a square with four fixed points on its corners and a fixed point at its centre. Let the five points correspond to the digits (1, 2, 3, 4, 5) of numbers in base 6 (not using 0, to simplify matters):

1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 21, 22, 23, 24, 25, 31, 32, 33, 34, 35, 41, 42, 43, 44, 45, 51, 52, 53, 54, 55, 61, 62, 63, 64, 65… 2431, 2432, 2433, 2434, 2435, 2441, 2442, 2443, 2444, 2445, 2451, 2452…

Move between the five points of the square by stepping through the individual digits of the numbers in the sequence. For example, if the number is 2451, the first set of successive digits is (2, 4), so you move to a point half-way between point 2 and point 4. Next come the successive digits (4, 5), so you move to a point half-way between point 4 and point 5. Then come (5, 1), so you move to a point half-way between point 5 and point 1.

When you’ve exhausted the digits (or frigits) of a number, mark the final point you moved to (changing the colour of the pixel if the point has been occupied before). If you follow this procedure using a five-point square, you will create a fractal something like this:

A pentagon without a central point using numbers in a zero-less base 7 looks like this:

A pentagon with a central point looks like this:

Hexagons using a zero-less base 8 look like this:

But the images above are just the beginning. If you use a fixed base while varying the polygon and so on, you can create images like these (here is the program I used):