Sorted for D’s nand Wizz

As I’ve pre-previously pointed out, there are an infinite number of points in the plane. And in part of the plane. So you have to pare points to create interesting shapes. One way of paring points is by comparing them. After you’ve compared them, you can sort them. For example, you can compare the distance from (x,y) to the four vertices of a square. Then you can sort the distances from nearest to furthest. Then you can mark (x,y) if the distance to, say, the nearest vertice from (x,y) is evenly divisible by 2 when measured in pixels or some other unit. When you do that, you might get an image like this (depending on the hardware and software you use):

Distance to nearest vertex is evenly divisible by 2, i.e. d mod 2 = 0 for v1 (vertices marked in red)


Or you can mark (x,y) if the distance to the nearest vertex is a triangular number:

is_triangular(d) for v1


Or a square number:

is_square(d) for v1


Or you can test the distance to the second-nearest vertex:

d mod 2 = 0 for v2


And the third-nearest (or second-furthest) vertex:

d mod 2 = 0 for v3


And furthest vertex:

d mod 2 = 0 for v4


Now try expanding or contracting the square:

d mod 2 = 0 for v1 on square * 2


d mod 2 = 0 for v1 on square * 3


d mod 2 = 0 for v1 on square * 0.5


d mod 2 = 0 for v1 on square * 1.5


d mod 2 = 0 for v1 on square * 5


d mod 2 = 0 for v1 on square * 20


d mod 2 = 0 for v1 on square * 100


Finally, here are some more mandala-like images created by using various d mod m on an expanded square (the images should be horizontally and vertically mirror-symmetrical, but my software introduced artefacts):

d mod 2 = 0 for v1 on square * 200
(open in separate window for better detail)


d mod 3 = 0 for v1 on square * 200


d mod 4 = 0 for v1 on square * 200


d mod 5 = 0 for v1 on square * 200


d mod 6 = 0 for v1 on square * 200


d mod 7 = 0 for p1 on square * 200


d mod 8 = 0 for p1 on square * 200


d mod 9 = 0 for p1 on square * 200


d mod 2..9 = 0 for p1 on square * 200 (animated at EZgif)


Post-Performative Post-Scriptum…

The title of this incendiary intervention is a paronomasia on “Sorted for E’s and Wizz”, a song offa of 1995 album Different Class by Sheffield Brit-popsters Pulp rebelliously referencing counter-cultural consumption of psychoactive drugs ecstasy and amphetamine. My program sorted distances, i.e. d’s, but not wizz, therefore it sorted d’s and-not wizz. In Boolean logic, nand means “and-not” (roughly speaking).


Previously Pre-Posted (Please Peruse)…

Points Pared — an earlier look at points and polygons

Fract-L Geometry

Suppose you set up an L, i.e. a vertical and horizontal line, representing the x,y coordinates between 0 and 1. Next, find the fractional pairs x = 1/2, 1/3, 2/3, 1/4, 2/4…, y = 1/2, 1/3, 2/3, 1/4, 2/4… and mark the point (x,y). That is, find the point, say, 1/5 of the way along the x-line, then the points 1/5, 2/5, 3/5 and 4/5 along the y-line, marking the points (1/5, 1/5), (1/5, 2/5), (1/5, 3/5), (1/5, 4/5). Then find (2/5, 1/5), (2/5, 2/5), (2/5, 3/5), (2/5, 4/5) and so on. Some interesting patterns appear in what I call a Frac-L (pronounced “frackle”) or Fract-L:

Frac-L for 1/2 to 21/22


Frac-L for 1/2 to 48/49


Frac-L for 1/2 to 75/76


Frac-L for 1/2 to 102/103


Frac-L for 1/2 to 102/103 (animated)


If the (x,y) point is first red, then becomes different colors as it is repeatedly found, you get these patterns:

Frac-L for 1/2 to 48/49 (color)


Frac-L for 1/2 to 75/79 (color)


Frac-L for 1/2 to 102/103 (color) (animated)


Now try polygonal numbers. The triangular numbers are 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78…, so you’re finding the fractional pairs, say, (1/21, 1/21), (1/21, 3/21, (1/21, 6/21), (1/21, 10/21), (1/21, 15/21), then (3/21, 1/21), (3/21, 3/21, (3/21, 6/21), (3/21, 10/21), (3/21, 15/21), and so on:

Frac-L for triangular fractions


The frac-L for square numbers (1, 4, 9, 16, 25, 36, 49, 64, 81, 100…) is almost identical:

Frac-L for square fractions, e.g. (1/16, 1/16), (1/16, 4/16), (1/16, 9/16)…


So is the frac-L for pentagonal numbers (1, 5, 12, 22, 35, 51, 70, 92, 117, 145, 176, 210, 247, 287, 330…):

Frac-L for pentagonal fractions, e.g. (1/35, 5/35), (1/35, 12/35), (1/35,22/35)…


Here are frac-Ls for tetrahedral and square-pyramidal numbers:

Frac-L for tetrahedral fractions


Frac-L for square pyramidal fractions


But what about prime numbers (skipping 2)? Here the fractional pairs are, say, (1/17, 1/17), (1/17, 3/17), (1/17, 5/17), (1/17, 7/17), (1/17, 11/17), (1/17, 13/17), then (3/17, 1/17), (3/17, 3/17), (3/17, 5/17), (3/17, 7/17), (3/17, 11/17), (3/17, 13/17), and so on:

Frac-L for 1/3 to 73/79 (prime fractions)


Frac-L for 1/3 to 223/227


Frac-L for 1/3 to 307/331


Frac-L for 1/3 to 307/331 (animated)


Frac-L for 1/3 to 73/79 (color) (prime fractions)


Frac-L for 1/3 to 223/227 (color)


Frac-L for 1/3 to 307/331 (color)


Frac-L for 1/3 to 307/331 (color) (animated)


And finally (for now), a frac-L for Fibonnaci numbers, where the fractional pairs are, say, (1/13, /13), (1/13, 2/13), (1/13, 3/13), (1/13, 5/13), (1/13, 8/13), then (2/13, /13), (2/13, 2/13), (2/13, 3/13), (2/13, 5/13), (2/13, 8/13), and so on:

Frac-L for Fibonacci fractions to 14930352/2178309 = fibonacci(36)/fibonacci(37)


Summer Sets (and Truncated Triangulars)

Here is the sequence of triangular numbers, created by summing consecutive integers from 1 (i.e., 1+2+3+4+5…):


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, 1485, 1540, 1596, 1653, 1711, 1770, 1830, 1891, 1953, 2016, 2080, 2145, 2211, 2278, 2346, 2415, 2485, 2556, 2628, 2701, 2775, 2850, 2926, 3003, 3081, 3160, 3240, 3321, 3403, 3486, 3570, 3655, 3741, 3828, 3916, 4005, 4095, 4186, 4278, 4371, 4465, 4560, 4656, 4753, 4851, 4950, 5050, 5151, 5253, 5356, 5460, 5565, 5671, 5778, 5886, 5995...

And here is a sequence of truncated triangulars, created by summing consecutive integers from 15 (i.e., 15+16+17+18+19…):


15, 31, 48, 66, 85, 105, 126, 148, 171, 195, 220, 246, 273, 301, 330, 360, 391, 423, 456, 490, 525, 561, 598, 636, 675, 715, 756, 798, 841, 885, 930, 976, 1023, 1071, 1120, 1170, 1221, 1273, 1326, 1380, 1435, 1491, 1548, 1606, 1665, 1725, 1786, 1848, 1911, 1975, 2040, 2106, 2173, 2241, 2310, 2380, 2451, 2523, 2596, 2670, 2745, 2821, 2898, 2976, 3055, 3135, 3216, 3298, 3381, 3465, 3550, 3636, 3723, 3811, 3900, 3990, 4081, 4173, 4266, 4360, 4455, 4551, 4648, 4746, 4845, 4945, 5046, 5148, 5251, 5355, 5460, 5566, 5673, 5781...

It’s obvious that the sequences are different at each successive step: 1 ≠ 15, 3 ≠ 31, 6 ≠ 48, 10 ≠ 66, 21 ≠ 85, and so on. But seven numbers occur in both sequences: 15, 66, 105, 171, 561, 1326 and 5460. And that’s it — 7 is the 14-th entry in A309507 at the Encyclopedia of Integer Sequences:


0, 1, 1, 1, 3, 3, 1, 2, 5, 3, 3, 3, 3, 7, 3, 1, 5, 5, 3, 7, 7, 3, 3, 5, 5, 7, 7, 3, 7, 7, 1, 3, 7, 7, 11, 5, 3, 7, 7, 3, 7, 7, 3, 11, 11, 3, 3, 5, 8, 11, 7, 3, 7, 15, 7, 7, 7, 3, 7, 7, 3, 11, 5, 3, 15, 7, 3, 7, 15, 7, 5, 5, 3, 11, 11, 7, 15, 7, 3, 9, 9, 3, 7 — A309507

I decided to take create graphs of shared numbers in compared sequences like this. In the 135×135 grid below, the brightness of the squares corresponds to the count of shared numbers in the sequence-pair sum(x..x+n) and sum(y..y+n), where x and y are the coordinates of each individual square. I think the grid looks like a city of skyscrapers bisected by a highway:

Count of shared numbers in sequence-pairs sum(x..x+n) and sum(y..y+n)


Note that the bright white diagonal in the grid corresponds to the sequence-pairs where x = y. Because the sequences are identical in each pair, the count of shared numbers is infinite. The grid is symmetrically reflected along the diagonal because, for example, the sequence-pair for x=12, y=43, where sum(12..12+n) is compared with sum(43..43+n), corresponds to the sequence pair for x=43, y=12, where sum(43..43+n) is compared with sum(12..12+n). The scale of brightness runs from 0 (black) to 255 (full white) and increases by 32 for each shared number in the sequence. Obviously, then, the brightness can’t increase indefinitely and some maximally bright squares will represent sequence-pairs that have different counts of shared pairs.

Now try altering the size of the step in brightness. You get grids in which the width of the central strip increases (smaller step) or decreases (bigger step). Here are grids for steps for 1, 2, 4, 8, 16, 32 and 64 (I’ve removed the bright x=y diagonal for the first few grids, because it’s too prominent against duller shades):

Brightness-step = 1


Brightness-step = 2


Brightness-step = 4


Brightness-step = 8


Brightness-step = 16


Brightness-step = 32


Brightness-step = 63


Brightness-step = 1, 2, 4, 8, 16, 32, 63 (animated)


Nexcelsior

In “The Trivial Troot”, I looked at what happens when tri(k), the k-th triangular number, is one digit longer than the previous triangular number, tri(k-1):


6 = tri(3)
10 = tri(4)


91 = tri(13)
105 = tri(14)


990 = tri(44)
1035 = tri(45)
[...]

10 ← 4
105 ← 14
1035 ← 45
10011 ← 141
100128 ← 447
1000405 ← 1414
10001628 ← 4472
100005153 ← 14142
1000006281 ← 44721
10000020331 ← 141421
100000404505 ← 447214
1000001326005 ← 1414214
10000002437316 ← 4472136
100000012392316 ← 14142136
[...]

What’s going on with k? In a sense, it’s calculating the square roots of 2 and 20:

√2 = 1·414213562373095048801688724209698078569671875376948073176679738...
√20 = 4·472135954999579392818347337462552470881236719223051448541794491...

Now let’s say “Excelsior!” and go higher with a related sequence. A006003 is defined at the Online Encyclopedia of Integer Sequences as the “sum of the next n natural numbers”. Here it is:


1 = 1
5 = 2 + 3
15 = 4 + 5 + 6
34 = 7 + 8 + 9 + 10
65 = 11 + 12 + 13 + 14 + 15
111 = 16 + 17 + 18 + 19 + 20 + 21
175 = 22 + 23 + 24 + 25 + 26 + 27 + 28
260 = 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36
369 = 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45
505 = 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55
671 = 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66
870 = 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78
1105 = 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91
1379 = 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105
1695 = 106 + 107 + 108 + 109 + 110 + 111 + 112 + 113 + 114 + 115 + 116 + 117 + 118 + 119 + 120
2056 = 121 + 122 + 123 + 124 + 125 + 126 + 127 + 128 + 129 + 130 + 131 + 132 + 133 + 134 + 135 + 136
2465 = 137 + 138 + 139 + 140 + 141 + 142 + 143 + 144 + 145 + 146 + 147 + 148 + 149 + 150 + 151 + 152 + 153
2925 = 154 + 155 + 156 + 157 + 158 + 159 + 160 + 161 + 162 + 163 + 164 + 165 + 166 + 167 + 168 + 169 + 170 + 171
3439 = 172 + 173 + 174 + 175 + 176 + 177 + 178 + 179 + 180 + 181 + 182 + 183 + 184 + 185 + 186 + 187 + 188 + 189 + 190
4010 = 191 + 192 + 193 + 194 + 195 + 196 + 197 + 198 + 199 + 200 + 201 + 202 + 203 + 204 + 205 + 206 + 207 + 208 + 209 + 210
[...]

If you’re familiar with triangular numbers, you’ll see that sumnext(k) is always higher than tri(k), except for sumnext(1) = 1 = tri(k). Now, this is what happens when sumnext(k) is one digit longer than sumnext(k-1):


5 = sumnext(2)
15 = sumnext(3)


65 = sumnext(5)
111 = sumnext(6)


870 ← 12
1105 ← 13


9855 ← 27
10990 ← 28


97585 ← 58
102719 ← 59


976625 ← 125
1000251 ← 126


9951391 ← 271
10061960 ← 272


99588644 ← 584
100101105 ← 585


997809119 ← 1259
1000188630 ← 1260


9995386529 ← 2714
10006439295 ← 2715
[...]

15 ← 3
111 ← 6
1105 ← 13
10990 ← 28
102719 ← 59
1000251 ← 126
10061960 ← 272
100101105 ← 585
1000188630 ← 1260
10006439295 ← 2715
100049490449 ← 5849
1000188006300 ← 12600
10000910550385 ← 27145
100003310078561 ← 58481
1000021311323825 ← 125993
10000026341777165 ← 271442
100000232056567634 ← 584804
1000002262299152685 ← 1259922
10000004237431278525 ← 2714418
100000026858987459346 ← 5848036
1000000119305407615071 ← 12599211
10000000921801015908705 ← 27144177
100000001209342964609615 ← 58480355
1000000000250317736274865 ← 125992105
10000000037633414521952245 ← 271441762
100000000183357362892853070 ← 584803548
1000000000250317673908773025 ← 1259921050
[...]


What’s going on now? In a sense, the digits of k are approximating the cube roots of 20, 200 and 2000:


2.714417616594906571518089469679489204805107769489096957284365443... = cuberoot(20)
5.848035476425732131013574720275845557060997270202060082845147020... = cuberoot(200)
12.59921049894873164767210607278228350570251464701507980081975112... = cuberoot(2000)


cuberoot(20) = 2.714417616594906571518089469679489204805107769489096957284365443...
cuberoot(200) = 5.848035476425732131013574720275845557060997270202060082845147020...
cuberoot(2000) = 12.59921049894873164767210607278228350570251464701507980081975112...


So you could say that this sequence has gone nexcelsior: sumnext(k) > tri(k); cubes are higher than squares; and (20, 200, 2000) is bigger than (2, 20).


Previously Pre-Posted…

• “The Trivial Troot” — explaining the earlier pattern in triangular numbers

Fine as Nine

This is a regular nonagon (a polygon with nine sides):

A nonagon or enneagon (from Wikipedia)

And this is the endlessly repeating decimal of the reciprocal of 7:

1/7 = 0.142857142857142857142857…

What is the curious connection between 1/7 and nonagons? If I’d been asked that a week ago, I’d’ve had no answer. Then I found a curious connection when I was looking at the leading digits of polygonal numbers. A polygonal number is a number that can be represented in the form of a polygon. Triangular numbers look like this:


* = 1

*
** = 3

*
**
*** = 6

*
**
***
**** = 10

*
**
***
****
***** = 15

By looking at the shapes rather than the numbers, it’s easy to see that you generate the triangular numbers by simply summing the integers:


1 = 1
1+2=3
1+2+3=6
1+2+3+4=10
1+2+3+4+5=15

Now try the square numbers:


* = 1

**
** = 4

***
***
*** = 9

****
****
****
**** = 16

*****
*****
*****
*****
***** = 25


You generate the square numbers by summing the odd integers:


1 = 1
1+3 = 4
1+3+5 = 9
1+3+7 = 16
1+3+7+9 = 25

Next come the pentagonal numbers, the hexagonal numbers, the heptagonal numbers, and so on. I was looking at the leading digits of these numbers and trying to find patterns. For example, when do the leading digits of the k-th triangular number, tri(k), match the digits of k? This is when:


tri(1) = 1
tri(19) = 190
tri(199) = 19900
tri(1999) = 1999000
tri(19999) = 199990000
tri(199999) = 19999900000
[...]

That pattern is easy to explain. The formula for the k-th polygonal number is k * ((pn-2)*k + (4-pn)) / 2, where pn = 3 for the triangular numbers, 4 for the square numbers, 5 for the pentagonal numbers, and so on. Therefore the k-th triangular number is k * (k + 1) / 2. When k = 19, the formula is 19 * (19 + 1) / 2 = 19 * 20 / 2 = 19 * 10 = 190. And so on. Now try the pol(k) = leaddig(pol(k)) for higher polygonal numbers. The patterns are easy to predict until you get to the nonagonal numbers:


square(10) = 100
square(100) = 10000
square(1000) = 1000000
square(10000) = 100000000
square(100000) = 10000000000
[...]


pentagonal(7) = 70
pentagonal(67) = 6700
pentagonal(667) = 667000
pentagonal(6667) = 66670000
pentagonal(66667) = 6666700000
[...]


hexagonal(6) = 66
hexagonal(51) = 5151
hexagonal(501) = 501501
hexagonal(5001) = 50015001
hexagonal(50001) = 5000150001
[...]


heptagonal(5) = 55
heptagonal(41) = 4141
heptagonal(401) = 401401
heptagonal(4001) = 40014001
heptagonal(40001) = 4000140001
[...]


octagonal(4) = 40
octagonal(34) = 3400
octagonal(334) = 334000
octagonal(3334) = 33340000
octagonal(33334) = 3333400000
[...]


nonagonal(4) = 46
nonagonal(30) = 3075
nonagonal(287) = 287574
nonagonal(2858) = 28581429
nonagonal(28573) = 2857385719
nonagonal(285715) = 285715000000
nonagonal(2857144) = 28571444285716
nonagonal(28571430) = 2857143071428575
nonagonal(285714287) = 285714287571428574
nonagonal(2857142858) = 28571428581428571429
nonagonal(28571428573) = 2857142857385714285719
nonagonal(285714285715) = 285714285715000000000000
nonagonal(2857142857144) = 28571428571444285714285716
nonagonal(28571428571430) = 2857142857143071428571428575
nonagonal(285714285714287) = 285714285714287571428571428574
nonagonal(2857142857142858) = 28571428571428581428571428571429
nonagonal(28571428571428573) = 2857142857142857385714285714285719
nonagonal(285714285714285715) = 285714285714285715000000000000000000
nonagonal(2857142857142857144) = 28571428571428571444285714285714285716
nonagonal(28571428571428571430) = 2857142857142857143071428571428571428575
[...]


What’s going on with the leading digits of the nonagonals? Well, they’re generating a different reciprocal. Or rather, they’re generating the multiple of a different reciprocal:


1/7 * 2 = 2/7 = 0.285714285714285714285714285714...

And why does 1/7 have this curious connection with the nonagonal numbers? Because the nonagonal formula is k * (7k-5) / 2 = k * ((9-2) * k + (4-pn)) / 2. Now look at the pentadecagonal numbers, where pn = 15:


pentadecagonal(1538461538461538461540) = 15384615384615384615406923076923076923076930

2/13 = 0.153846153846153846153846153846...

pentadecagonal formula = k * (13k - 11) / 2 = k * ((15-2)*k + (4-15)) / 2

Penultimately, let’s look at the icosikaihenagonal numbers, where pn = 21:


icosikaihenagonal(2) = 21
icosikaihenagonal(12) = 1266
icosikaihenagonal(107) = 107856
icosikaihenagonal(1054) = 10544743
icosikaihenagonal(10528) = 1052878960
icosikaihenagonal(105265) = 105265947385
icosikaihenagonal(1052633) = 10526335263165
icosikaihenagonal(10526317) = 1052631731578951
icosikaihenagonal(105263159) = 105263159210526318
icosikaihenagonal(1052631580) = 10526315801578947370
icosikaihenagonal(10526315791) = 1052631579163157894746
icosikaihenagonal(105263157896) = 105263157896368421052636
icosikaihenagonal(1052631578949) = 10526315789497368421052643
icosikaihenagonal(10526315789475) = 1052631578947542105263157900
icosikaihenagonal(105263157894738) = 105263157894738263157894736845
icosikaihenagonal(1052631578947370) = 10526315789473706842105263157905
icosikaihenagonal(10526315789473686) = 1052631578947368689473684210526331
icosikaihenagonal(105263157894736843) = 105263157894736843000000000000000000
icosikaihenagonal(1052631578947368422) = 10526315789473684220526315789473684211
icosikaihenagonal(10526315789473684212) = 1052631578947368421257894736842105263166

2/19 = 0.1052631578947368421052631579

icosikaihenagonal formula = k * (19k - 17) / 2 = k * ((21-2)*k + (4-21)) / 2

And ultimately, let’s look at this other pattern in the leading digits of the triangular numbers, which I can’t yet explain at all:


tri(904) = 409060
tri(6191) = 19167336
tri(98984) = 4898965620
tri(996694) = 496699963165
tri(9989894) = 49898996060565
tri(99966994) = 4996699994681515
tri(999898994) = 499898999601055515
tri(9999669994) = 49996699999451815015
tri(99998989994) = 4999898999960055555015
tri(999996699994) = 499996699999945018150015
tri(9999989899994) = 49999898999996005055550015
tri(99999966999994) = 4999996699999994500181500015
tri(999999898999994) = 499999898999999600500555500015
[...]

You Sixy Beast

666 is the Number of the Beast. But it’s much more than that. After all, it’s a number, so it has mathematical properties (everything has mathematical properties, but it’s a sine-qua-non of numbers). For example, 666 is a palindromic number, reading the same forwards and backwards. And it’s a repdigit, consisting of a single repeated digit. Now try answering this question: how many pebbles are there in this triangle?



••
•••
••••
•••••
••••••
•••••••
••••••••
•••••••••
••••••••••
•••••••••••
••••••••••••
•••••••••••••
••••••••••••••
•••••••••••••••
••••••••••••••••
•••••••••••••••••
••••••••••••••••••
•••••••••••••••••••
••••••••••••••••••••
•••••••••••••••••••••
••••••••••••••••••••••
•••••••••••••••••••••••
••••••••••••••••••••••••
•••••••••••••••••••••••••
••••••••••••••••••••••••••
•••••••••••••••••••••••••••
••••••••••••••••••••••••••••
•••••••••••••••••••••••••••••
••••••••••••••••••••••••••••••
•••••••••••••••••••••••••••••••
••••••••••••••••••••••••••••••••
•••••••••••••••••••••••••••••••••
••••••••••••••••••••••••••••••••••
•••••••••••••••••••••••••••••••••••
••••••••••••••••••••••••••••••••••••


Counting the pebbles one by one would take a long time, but there’s a short-cut. Each line of the triangle after the first is one pebble longer than the previous line. There are 36 lines and therefore 36 pebbles in the final line. So the full number of pebbles = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36. And there’s an easy formula for that sum: (36^2 + 36) / 2 = (1296 + 36) / 2 = 1332 / 2 = 666.

So 666 is the 36th triangular number:


1 = 1
1+2 = 3
1+2+3 = 6
1+2+3+4 = 10
1+2+3+4+5 = 15
1+2+3+4+5+6 = 21
1+2+3+4+5+6+7 = 28
1+2+3+4+5+6+7+8 = 36
1+2+3+4+5+6+7+8+9 = 45
1+2+3+4+5+6+7+8+9+10 = 55
[...]
1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21+22+23+24+25+26+27+28+29+30+31+32+33+34+35+36 = 666

But what’s tri(666), the 666th triangular number? By the formula above, it equals (666^2 + 666) / 2 = (443556 + 666) / 2 = 444222 / 2 = 222111. But recall something else from above: tri(6) = 1+2+3+4+5+6 = 21. Is it a coincidence that tri(6) = 21 and tri(666) = 222111? No, it isn’t:


tri(6) = 21 = (6^2 + 6) / 2 = (36 + 6) / 2 = 42 / 2
tri(66) = 2211 = (66^2 + 66) / 2 = (4356 + 66) / 2 = 4422 / 2
tri(666) = 222111 = (666^2 + 666) / 2 = (443556 + 666) / 2 = 444222 / 2
tri(6666) = 22221111
tri(66666) = 2222211111
tri(666666) = 222222111111
tri(6666666) = 22222221111111
tri(66666666) = 2222222211111111
tri(666666666) = 222222222111111111
tri(6666666666) = 22222222221111111111
tri(66666666666) = 2222222222211111111111
tri(666666666666) = 222222222222111111111111
tri(6666666666666) = 22222222222221111111111111
tri(66666666666666) = 2222222222222211111111111111
tri(666666666666666) = 222222222222222111111111111111

So we’ve looked at tri(36) = 666 and tri(666) = 222111. Let’s go a step further: tri(222111) = 24666759216. So 666 appears again. And the sixiness carries on here:


tri(36) = 666
tri(3366) = 5666661
tri(333666) = 55666666611
tri(33336666) = 555666666666111
tri(3333366666) = 5555666666666661111
tri(333333666666) = 55555666666666666611111
tri(33333336666666) = 555555666666666666666111111
tri(3333333366666666) = 5555555666666666666666661111111
tri(333333333666666666) = 55555555666666666666666666611111111
tri(33333333336666666666) = 555555555666666666666666666666111111111
tri(3333333333366666666666) = 5555555555666666666666666666666661111111111
tri(333333333333666666666666) = 55555555555666666666666666666666666611111111111
tri(33333333333336666666666666) = 555555555555666666666666666666666666666111111111111
tri(3333333333333366666666666666) = 5555555555555666666666666666666666666666661111111111111
tri(333333333333333666666666666666) = 55555555555555666666666666666666666666666666611111111111111

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.

Tri Num Sum

The Sum of ten consecutive Triangular Numbers:

Starting with T0 = 0, in base 10,

The sum of the first 10 triangular numbers from T0 to T9 = 165
The sum of the next 10 triangular numbers from T10 to T19 = 1165
The sum of the next 10 triangular numbers from T20 to T29 = 3165
The sum of the next 10 triangular numbers from T30 to T39 = 6165
The sum of the next 10 triangular numbers from T40 to T49 = 10165
The sum of the next 10 triangular numbers from T50 to T59 = 15165

and so on.

The same pattern is evident in other bases [when summing T0 to Tbase-1 and so on].


• As submitted by Julian Beauchamp, 9v19, to Shyam Sunder Gupta’s “Fascinating Triangular Numbers”.

Triangular Squares

The numbers that are both square and triangular are beautifully related to the best approximations to √2:

Number

Square Root

Factors of root

1 1 1
36 6 2 * 3
1225 35 5 * 7
41616 204 12 * 17

and so on.

In each case the factors of the root are the numerator and denominator of the next approximation to √2. — David Wells, The Penguin Dictionary of Curious and Interesting Mathematics (1986), entry for “36”.


Elsewhere other-accessible

A001110 — Square triangular numbers: numbers that are both triangular and square