Square Routes Revisited

Take a square, divide it into four smaller squares, and discard the smaller square on the top right. Do the same to each of the subsquares, dividing it into four sub-subsquares, then discarding the one on the top right. And repeat with the sub-subsquares. And the sub-sub-squares. And the sub-sub-sub-squares. And so on. The result is a fractal like this:


Stage 1


Stage 2


Stage 3


Stage 4


Animated fractal


Final fractal (static)

It looks as though this procedure isn’t very fertile. But you can enrich it by rotating each of the subsquares in a different way, so that the discarded sub-subsquare is different. Here’s an example:

Stage 1

Stage 2

Stage 3

Stage 4

Stage 5

Stage 6

Stage 7

Animated fractal

Final fractal (static)

Here are more examples of how rotating the subsquares in different ways produces different fractals:

Animated fractal

Static fractal

Animated fractal

Static fractal

Animated fractal

Static fractal

Animated fractal

Static fractal

Animated fractal

Static fractal

Animated fractal

Static fractal

Animated fractal

Static fractal

Animated fractal

Static fractal

Animated fractal

Static fractal

Animated fractal

Static fractal

Animated fractal

Static fractal

Animated fractal

Static fractal

Animated fractal

Static fractal

Animated fractal

Static fractal

Animated fractal

Static fractal

Previously pre-posted:

Square Routes — first look at this kind of fractal


Corralling Chaos

“Down through the aether I saw the accursed earth turning, ever turning, with angry and tempestuous seas gnawing at wild desolate shores and dashing foam against the tottering towers of deserted cities.” — “The Crawling Chaos” (1921), Winifred Jackson and H. P. Lovecraft.

All the best people brood incessantly on the fact that a point inside a square jumping half-way towards a randomly chosen vertex will not create a fractal. Inside a triangle, yes: a fractal appears. Inside a pentagon too. But not inside a square:

Point jumping half-way towards a randomly chosen vertex

Instead, the interior of the square fills with random points: it crawls with chaos, you might say. However, fractals appear inside a square if the point is restricted in some way: banned from jumping towards a vertex twice in a row; banned from jumping towards the second-nearest vertex; and so on. Those restrictions are what might be called soft, because they take place in software (or in the brain of someone following the rule as a game or piece of performance art). Here’s what might be called a hard restriction that creates a fractal: the point cannot jump towards a randomly vertex if its jump passes over any part of the red upright cross:

Point cannot pass over red lines

I call this a barrier fractal. It’s obvious that the point cannot jump from one corner of the square towards the opposite corner, which creates bare space stretching from each vertex towards the tips of the upright cross. Less obvious is the way in which this bare space “cascades” into other parts of the square, creating a repeatedly branching and shrinking pattern.

When the barrier is a circle, a similar fractal appears:

If the point can also jump towards the center of the circle, this is what happens:

Now here’s an upright cross with a gap in the middle:

Here’s an upright cross when the point can also jump towards the center of the cross:

A slanted cross with a central attractor:

And a single horizontal stroke:

A slanted stroke — note pentagons:

Even if the barrier is small and set on an edge of the square, it affects the rest of the square:

A more attractive example of edge-affects-whole:

Circles away from the edges

Detail of previous image

Here the point can also jump towards the center of the square’s edges:

A more subtle barrier fractal uses the previous jumps of the point to restrict its next jump. For example, if the point cannot jump across the line created by its previous-but-one jump, it moves like this:

Jump can’t cross track of last-but-one jump (animated gif)

The fractal itself looks like this:

Rule: on jump #3, cannot jump across the line created by jump #1; on jump #4, cannot cross the line created by jump #2; and so on.

And this is the fractal if the point cannot jump across the line created by its previous-but-two jump:

Rule: on jump #4, cannot jump across the line created by jump #2; on jump #5, cannot cross the line created by jump #3; and so on

Get Your Prox Off #2

Serendipity is the art of making happy discoveries by accident. I made a mistake writing a program to create fractals and made the happy discovery of an attractive new fractal. And also of a new version of an attractive fractal I had seen before.

As I described in Get Your Prox Off, you can create a fractal by 1) moving a point towards a randomly chosen vertex of a polygon, but 2) forbidding a move towards the nearest vertex or the second-nearest vertex or third-nearest, and so on. If the polygon is a square, the four possible basic fractals look like this (note that the first fractal is also produced by banning a move towards a vertex that was chosen in the previous move):


v = 4, ban = prox(1)
(ban move towards nearest vertex)


v = 4, ban = prox(2)
(ban move towards second-nearest vertex)


v = 4, ban = prox(3)


v = 4, ban = prox(4)

This program has to calculate what might be called the order of proximity: that is, it creates an array of distances to each vertex, then sorts the array by increasing distance. I was using a bubble-sort, but made a mistake so that the program ran through the array only once and didn’t complete the sort. If this happens, the fractals look like this (note that vertex 1 is on the right, with vertex 2, 3 and 4 clockwise from it):

v = 4, ban = prox(1), sweep = 1


v = 4, ban = prox(2), sweep = 1


v = 4, ban = prox(3), sweep = 1


(Animated version of v4, ban(prox(3)), sw=1)


v = 4, ban = prox(4), sweep = 1

Note that in the last case, where ban = prox(4), a bubble-sort needs only one sweep to identify the most distant vertex, so the fractal looks the same as it does with a complete bubble-sort.

These new fractals looked interesting, so I had the idea of adjusting the number of sweeps in the incomplete bubble-sort: one sweep or two or three and so on (with enough sweeps, the bubble-sort becomes complete, but more sweeps are needed to complete a sort as the number of vertices increases). If there are two sweeps, then ban(prox(1)) and ban(prox(2)) look like this:


v = 4, ban = prox(1), sweep = 2


v = 4, ban = prox(2), sweep = 2

But the fractals produced by sweep = 2 for ban(prox(3)) and ban(prox(4)) are identical to the fractals produced by a complete bubble sort. Now, suppose you add a central point to the polygon and treat that as an additional vertex. If the bubble-sort is incomplete, a ban(prox(1)) fractal with a central point looks like this:


v = 4+c, ban = prox(1), sw = 1


v = 4+c, ban = prox(1), sw = 2

When sweep = 3, an attractive new fractal appears:


v = 4+c, ban = prox(1), sw = 3


v = 4+c, ban = prox(1), sw = 3 (animated)

If you ban two vertices, the nearest and second-nearest, i.e. ban(prox(1), prox(2)), a complete bubble-sort produces a familiar fractal:


v = 4+c, ban = prox(1), prox(2)

And here is ban(prox(2), prox(4)), with a complete bubble-sort:


v = 4, ban = prox(2), prox(4)

If the bubble-sort is incomplete, sweep = 1 and sweep = 2 produce these fractals for ban(prox(1), prox(2)):


v = 4, ban = prox(1), prox(2), sw = 1


v = 4, ban = prox(1), prox(2), sw = 2*

*The second of those fractals is identical to v = 4, ban(prox(2), prox(3)) with a complete bubble-sort.

Here is ban(prox(1), prox(5)) with a complete bubble-sort:


v = 4, ban = prox(1), prox(5)

Now try ban(prox(1), prox(5)) with an incomplete bubble-sort:


v = 4, ban = prox(1), prox(5), sw = 1


v = 4, ban = prox(1), prox(5), sw = 2

When sweep = 3, the fractal I had seen before appears:


v = 4, ban = prox(1), prox(5), sw = 3


v = 4, ban = prox(1), prox(5), sw = 3 (animated)

Where had I seen it before? While investigating this rep-tile (a shape that can be tiled with smaller versions of itself):


L-triomino rep-tile


L-triomino rep-tile (animated)

The rep-tile is technically called an L-triomino, because it looks like a capital L and is one of the two distinct shapes you can create by joining three squares at the edges. You can create fractals from an L-triomino by dividing it into four copies, discarding one of the copies, then repeating the divide-and-discard at smaller and smaller scales:


L-triomino fractal stage #1


L-triomino fractal stage #2


L-triomino fractal stage #3


L-triomino fractal stage #4


L-triomino fractal stage #5


L-triomino fractal (animated)


L-triomino fractal (close-up)

And here’s part of the ban(prox(1), prox(5)) fractal for comparison:



So you can get to the same fractal (or versions of it), by two apparently different routes: random movement of a point inside a square or repeatedly dividing-and-discarding the sub-copies of an L-triomino. That’s serendipity!

Previously pre-posted:

Get Your Prox Off

Boldly Breaking the Boundaries

In “M.I.P. Trip”, I looked at fractals like this, in which a square is divided repeatedly into a pattern of smaller squares:






As you can see, the sub-squares appear within the bounds of the original square. But what if some of the sub-squares appear beyond the bounds of the original square? Then a new family of fractals is born, the over-fractals:































M.i.P. Trip

The Latin phrase multum in parvo means “much in little”. It’s a good way of describing the construction of fractals, where the application of very simple rules can produce great complexity and beauty. For example, what could be simpler than dividing a square into smaller squares and discarding some of the smaller squares?

Yet repeated applications of divide-and-discard can produce complexity out of even a 2×2 square. Divide a square into four squares, discard one of the squares, then repeat with the smaller squares, like this:



Increase the sides of the square by a little and you increase the number of fractals by a lot. A 3×3 square yields these fractals:








And the 4×4 and 5×5 fractals yield more:















Fractal Fourmulas

A square can be divided into four right triangles. A right triangle can be divided into a square and two more right triangles. These simple rules, applied again and again, can be used to create fractals, or shapes that echo themselves on smaller and smaller scales.








V for Vertex

To create a simple fractal, take an equilateral triangle and divide it into four more equilateral triangles. Remove the middle triangle. Repeat the process with each new triangle and go on repeating it. You’ll end up with a shape like this, which is known as the Sierpiński triangle, after the Polish mathematician Wacław Sierpiński (1882-1969):

Sierpinski triangle

But you can also create the Sierpiński triangle one pixel at a time. Choose any point inside an equilateral triangle. Pick a corner of the triangle at random and move half-way towards it. Mark this spot. Then pick a corner at random again and move half-way towards the corner. And repeat. The result looks like this:


A simple program to create the fractal looks like this:

until false

function initial()
  v = 3 [v for vertex]
  r = 500
  lm = 0.5

function fractal()
  th = 2 * pi / v
[the following loop creates the corners of the triangle]
  for l = 1 to v
    x[l]=xcenter + sin(l*th) * r
    y[l]=ycenter + cos(l*th) * r
  next l
  fx = xcenter
  fy = ycenter
    rv = random(v)
    fx = fx + (x[rv]-fx) * lm
    fy = fy + (y[rv]-fy) * lm
  until keypressed

function altervariables()
[change v, lm, r etc]

In this case, more is less. When v = 4 and the shape is a square, there is no fractal and plot(fx,fy) covers the entire square.


When v = 5 and the shape is a pentagon, this fractal appears:


But v = 4 produces a fractal if a simple change is made in the program. This time, a corner cannot be chosen twice in a row:


function initial()
  v = 4
  r = 500
  lm = 0.5
  ci = 1 [i.e, number of iterations since corner previously chosen]

function fractal()
  th = 2 * pi / v
  for l = 1 to v
    x[l]=xcenter + sin(l*th) * r
    y[l]=ycenter + cos(l*th) * r
  next l
  fx = xcenter
  fy = ycenter
      rv = random(v)
    until chosen[rv]=0
    for l = 1 to v
      if chosen[l]>0 then chosen[l] = chosen[l]-1
    next l
    chosen[rv] = ci
    fx = fx + (x[rv]-fx) * lm
    fy = fy + (y[rv]-fy) * lm
  until keypressed

One can also disallow a corner if the corner next to it has been chosen previously, adjust the size of the movement towards the chosen corner, add a central point to the polygon, and so on. Here are more fractals created with such variations:








Sumbertime Views

Like 666 (see Revelation 13:18), 153 (see John 21:11) appears in the Bible. And perhaps for the same reason: because it is the sum of successive integers. 153 = 1+2+3+…+17 = Σ(17), just as 666 = Σ(36). So both numbers are sum-numbers or sumbers. But 153 has other interesting properties, including one that can’t have been known in Biblical times, because numbers weren’t represented in the right way. It’s also the sum of the cubes of its digits: 153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27. So 153 is a cube-sumber or 3-sumber. The other 3-sumbers are 370, 371 and 407. There are 4-sumbers too, like 1,634 = 1^4 + 6^4 + 3^4 + 4^4, and 5-sumbers, like 194,979 = 1^5 + 9^5 + 4^5 + 9^5 + 7^5 + 9^5, and 6-sumbers, like 548,834 = 5^6 + 4^6 + 8^6 + 8^6 + 3^6 + 4^6.

But there are no 2-sumbers, or numbers that are the sum of the squares of their digits. It doesn’t take long to confirm this, because numbers above a certain size can’t be 2-sumbers. 9^2 + 9^2 = 162, but 9^2 + 9^2 + 9^2 = 243. So 2-sumbers can’t exist above 99 and if you search that high you’ll find that they don’t exist at all. At least not in this house, but they do exist in the houses next door. Base 10 yields nothing, so what about base 9?

4^2 + 5^2 = 45[9] = 41[10]
5^2 + 5^2 = 55[9] = 50

And base 11?

5^2 + 6^2 = 56[11] = 61[10]
6^2 + 6^2 = 66[11] = 72

This happens because odd bases always yield a pair of 2-sumbers whose second digit is one more than half the base and whose first digit is the same or one less. See above (and the appendix). Such a pair is found among the 14 sumbers of base 47, which is the best total till base 157 and its 22 sumbers. Here are the 2-sumbers for base 47:

2^2 + 10^2 = 104
3^2 + 12^2 = 153
5^2 + 15^2 = 250
9^2 + 19^2 = 442
12^2 + 21^2 = 585
14^2 + 22^2 = 680
23^2 + 24^2 = 1,105
24^2 + 24^2 = 1,152
33^2 + 22^2 = 1,573
35^2 + 21^2 = 1,666
38^2 + 19^2 = 1,805
42^2 + 15^2 = 1,989
44^2 + 12^2 = 2,080
45^2 + 10^2 = 2,125

As the progressive records for 2-sumber-totals are set, subsequent bases seem to either match or surpass them, except in three cases below base 450:

2 in base 5
4 in base 7
6 in base 13
10 in base 43
14 in base 47
22 in base 157
8 in base 182*
16 in base 268*
30 in base 307
18 in base 443*

Totals for sums of squares in bases 4 to 450

Totals for sums-of–squares in bases 4 to 450 (click for larger image)

Appendix: Odd Bases and 2-sumbers

Take an even number and half of that even number: say 12 and 6. 12 x 6 = 11 x 6 + 6. Further, 12 x 6 = 2 x 6 x 6 = 2 x 6^2 = 6^2 + 6^2. Accordingly, 66[11] = 6 x 11 + 6 = 12 x 6 = 6^2 + 6^2. So 66 in base 11 is a 2-sumber. Similar reasoning applies to every other odd base except base-3 [update: wrong!]. Now, take 12 x 5 = 2 x 6 x 5 = 2 x (5×5 + 5) = 5^2+5 + 5^5+5 = 5^5 + 5^5+2×5. Further, 5^5+2×5 = (5+1)(5+1) – 1 = 6^2 – 1. Accordingly, 56[11] = 11×5 + 6 = 12×5 + 1 = 5^2 + 6^2. Again, similar reasoning applies to every other odd base except base-3 [update: no — 1^2 + 2^2 = 12[3] = 5; 2^2 + 2^2 = 22[3] = 8]. This means that every odd base b, except base-3, will supply a pair of 2-sumbers with digits [d-1][d] and [d][d], where d = (b + 1) / 2.

Rep-Tile Reflections

A rep-tile, or repeat-tile, is a two-dimensional shape that can be divided completely into copies of itself. A square, for example, can be divided into smaller squares: four or nine or sixteen, and so on. Rectangles are the same. Triangles can be divided into two copies or three or more, depending on their precise shape. Here are some rep-tiles, including various rep-triangles:

Various rep-tiles

Various rep-tiles — click for larger image

Some are simple, some are complex. Some have special names: the sphinx and the fish are easy to spot. I like both of those, particularly the fish. It would make a good symbol for a religion: richly evocative of life, eternally sub-divisible of self: 1, 9, 81, 729, 6561, 59049, 531441… I also like the double-square, the double-triangle and the T-tile in the top row. But perhaps the most potent, to my mind, is the half-square in the bottom left-hand corner. A single stroke sub-divides it, yet its hypotenuse, or longer side, represents the mysterious and mind-expanding √2, a number that exists nowhere in the physical universe. But the half-square itself is mind-expanding. All rep-tiles are. If intelligent life exists elsewhere in the universe, perhaps other minds are contemplating the fish or the sphinx or the half-square and musing thus: “If intelligent life exists elsewhere in the universe, perhaps…”

Mathematics unites human minds across barriers of language, culture and politics. But perhaps it unites minds across barriers of biology too. Imagine a form of life based on silicon or gas, on unguessable combinations of matter and energy in unreachable, unobservable parts of the universe. If it’s intelligent life and has discovered mathematics, it may also have discovered rep-tiles. And it may be contemplating the possibility of other minds doing the same. And why confine these speculations to this universe and this reality? In parallel universes, in alternative realities, minds may be contemplating rep-tiles and speculating in the same way. If our universe ends in a Big Crunch and then explodes again in a Big Bang, intelligent life may rise again and discover rep-tiles again and speculate again on their implications. The wildest speculation of all would be to hypothesize a psycho-math-space, a mental realm beyond time and matter where, in mathemystic communion, suitably attuned and aware minds can sense each other’s presence and even communicate.

The rep-tile known as the fish

Credo in Piscem…

So meditate on the fish or the sphinx or the half-square. Do you feel the tendrils of an alien mind brush your own? Are you in communion with a stone-being from the far past, a fire-being from the far future, a hive-being from a parallel universe? Well, probably not. And even if you do feel those mental tendrils, how would you know they’re really there? No, I doubt that the psycho-math-space exists. But it might and science might prove its existence one day. Another possibility is that there is no other intelligent life, never has been, and never will be. We may be the only ones who will ever muse on rep-tiles and other aspects of mathematics. Somehow, though, rep-tiles themselves seem to say that this isn’t so. Particularly the fish. It mimics life and can spawn itself eternally. As I said, it would make a good symbol for a religion: a mathemysticism of trans-biological communion. Credo in Piscem, Unum et Infinitum et Æternum. “I believe in the Fish, One, Unending, Everlasting.” That might be the motto of the religion. If you want to join it, simply wish upon the fish and muse on other minds, around other stars, who may be doing the same.