A FracTeasel on a Fract-L

Here are two new fractals, both of which remind me of the seedheads of the wildflower known as a teasel, Dipsacus fullonum:

A FracTeasel fractal


Dried seedheads of teasel, Dipsacus fullonum (Wikipedia)


Another FracTeasel fractal (embedded in the first)


Flowering seedhead of teasel, Dipsacus fullonum (Wikipedia)


How do you create the two FracTeasels? Let’s look first at the fractal they’re inspired by. In “Back to Frac’” I talked about this fractional fractal, a variant of what I call the limestone fractal:

Variant of a limestone fractal or gryke fractal


It’s a fractal on a fract-L, that is, the x and y co-ordinates of the red L represent pairs of fractions generating decimals between 0 and 1. The x represents the fractions a1/b1 = 1/n to (n-1)/n in simplest form: 1/2, 1/3, 2/3, 1/4, 3/4, 1/5, 2/5, 3/5, 4/5, 1/6, 5/6, 1/7, 2/7, 3/7, 4/7, 5/7, 6/7, 1/8, 3/8, 5/8, 7/8,…

And what about the y? It represents the fraction found by taking the continued fraction of a1/b1, reversing it, and generating a new fraction, a2/b2, from the reversal. For example, here’s the continued fraction of a1/b1 = 3/23 = 0.1304347826…:

contfrac(3/23) = 7,1,2

The continued fraction of a1/b1 = 3/23 is used like this to reconstruct a1/b1:

7,1,2

0 → 1 / (0 + 2) = 1/2 → 1 / (1/2 + 1) = 2/3 → 1 / (7 + 2/3) = 3/23

Now reverse the continued fraction, 7,1,2 → 2,1,7, and generate a2/b2:

2,1,7

0 → 1 / (0 + 7) = 1/7 → 1 / (1/7 + 1) = 7/8 → 1 / (2 + 7/8) = 8/23 = 0.3478260869565…

The limestone fractal above appears when a1/b1 → a2/b2 for a1/b1 = 1/2, 1/3, 2/3, 1/4, 3/4, 1/5, 2/5, 3/5, 4/5, 1/6, 5/6, 1/7, 2/7, 3/7, 4/7, 5/7, 6/7, 1/8, 3/8, 5/8, 7/8,… But you can do other things to contfrac(a1/b1) beside just reversing it. What about the permutations of contfrac(a1/b1), for example? If length(contfrac(a1/b1)) = n, the permutations can generate up to n! (factorial n) new a2/b2 for the y co-ordinate (if all the numbers of contfrac(a1/b1) are different, you’ll get n! permutations). The resultant fractal is the first of the FracTeasels above (note that a2/b2 isn’t multipled by two):

FracTeasel #1 from fract-L for y = perm(contfrac(a1/b1))


If you think about it, you’ll see that the fractal from permed contfrac(a1/b1) contains the fractal from reversed contfrac(a1/b1). It also contains the second FracTeasel:

FracTeasel #2


How so? Because the second FracTeasel — let’s call it the stemmed FracTeasel — is created by shifting some numbers in contfrac(a1/b1) and leaving others alone. For example:

contfrac(940/1089) = 1, 6, 3, 4, 5, 2 → 1, 4, 3, 2, 5, 6 = contfrac(1008/1243)

So the function is finding one particular permutation of contfrac(a1/b1) to generate a2/b2, not all permutations. And so the function creates the stemmed FracTeasel, which carries an infinite number of seedheads on the same stem. To show that, here’s an animated gif zooming in on the bend of the fract-L for the stemmed FracTeasel:

Zooming the FracTeasel (animated at ezGif)


Elsewhere Other-Accessible…

I Like Gryke — a first look at the limestone fractal
Lime Time — more on the limestone fractal

Matchin’ Fraction

I wondered whether contfrac(a/b), the continued fraction of a/b, ever matched the digits of a and b in some base. The answer was yes. But I haven’t found any examples in base 10:

3,1,2 = contfrac(3/12) in base 9 = contfrac(3/11) in base 10
4,1,3 = contfrac(4/13) in b16 = contfrac(4/19) in b10
5,1,45/14 in b25 = 5/29
6,1,56/15 in b36 = 6/41
25,22/52 in b9 = 2/47 → 23,2
7,1,67/16 in b49 = 7/55
8,1,78/17 in b64 = 8/71
9,1,89/18 in b81 = 9/89
A,1,9A/19 in b100 = 10/109 → 10,1,9
42,1,34/213 in b8 = 4/139 → 34,1,3
4,1,2,3,341/233 in b8 = 33/155
1,17,1,2,3117/123 in b14 = 217/227 → 1,21,1,2,3
3A,33/A3 in b28 = 3/283 → 94,3
3,5,A,235/A2 in b34 = 107/342 → 3,5,10,2
3,1,4,1,4,1,5314/1415 in b8 = 204/781
2,1,36,3,2213/632 in b12 = 303/902 → 2,1,42,3,2
3,2,11,2,2,2321/1222 in b9 = 262/911 → 3,2,10,2,2,2
4H,44/H4 in b65 = 4/1109 → 277,4
6,2,1,3,J62/13J in b35 = 212/1349 → 6,2,1,3,19
8,3,3,1,D83/31D in b22 = 179/1487 → 8,3,3,1,13
93,1,89/318 in b27 = 9/2222 → 246,1,8
1,3A,1,1,4,2,213A1/1422 in b12 = 2281/2330 → 1,46,1,1,4,2,2
C7,1,BC/71B in b21 = 12/3119 → 259,1,11
1,2,2,1,O,F122/1OF in b50 = 2602/3715 → 1,2,2,1,24,15
2,1,1,5,55211/555 in b28 = 1597/4065 → 2,1,1,5,145
3,1,1,A,K,6311/AK6 in b29 = 2553/8996 → 3,1,1,10,20,6
1,2[70],1,3,912[70]/139 in b98 = 9870/9907 → 1,266,1,3,9
1,E,4,1,M,71E4/1M7 in b100 = 11404/12207 → 1,14,4,1,22,7
LG,5,4L/G54 in b28 = 21/12688 → 604,5,4
G4,1,FG/41F in b64 = 16/16463 → 1028,1,15

Fractional Fractal Fract-Ls

This is the surpassingly special Stern-Brocot sequence:

0, 1, 1, 2, 1, 3, 2, 3, 1, 4, 3, 5, 2, 5, 3, 4, 1, 5, 4, 7, 3, 8, 5, 7, 2, 7, 5, 8, 3, 7, 4, 5, 1, 6, 5, 9, 4, 11, 7, 10, 3, 11, 8, 13, 5, 12, 7, 9, 2, 9, 7, 12, 5, 13, 8, 11, 3, 10, 7, 11, 4, 9, 5, 6, 1, 7, 6, 11, 5, 14, 9, 13, 4, 15, 11, 18, 7, 17, 10, 13, 3, 14, 11, 19, 8, 21, 13, 18, 5, 17, 12, 19, … (A002487 at the Online Encyclopedia of Integer Sequences)


And why is the sequence special? Because if you take successive pairs of the apparently arbitrarily varying numbers, you get every rational fraction in its simplest form exactly once. So 1/2, 2/3, 6/11 and 502/787 appear once and then never again. And so do 2/1, 3/2, 11/6 and 787/502. Et cetera, ad infinitum. If you map the Stern-Brocot sequence against the related Calkin-Wilk sequence, which has the same “all-simplest-fractions-exactly-once” properties, you can create this fractal, which I call a limestone fractal or gryke fractal:

Gryke fractal by mapping Stern-Brocot sequence against Calkin-Wilf sequence


The graph is what I call a Fract-L, because the lines for the x,y coordinates create an L. Each coordinate runs from 0 to 1, with the x set by the fraction from the Stern-Brocot sequence and the y set by the fraction from the Calkin-Wilf sequence (if a > b in a/b, use the conversion 1/(a/b) = b/a). But you can also find interesting patterns by mapping the Stern-Brocot sequence against itself. That is, you use two Stern-Brocot sequences that start in different places. Now, there are complicated ways to create the Stern-Brocot sequence using mathematical trees and sequential algorithms and so on. But there’s also an astonishingly simple way, a formula created by the Israeli mathematician Moshe Newman. If (a,b) is one pair of successive numbers in the sequence, the next pair (a,b) is found like this:

c = b
b = (2 * int(a/b) + 1) * b – a
a = c

This means that you can seed a Stern-Brocot sequence with any (correctly simplified) a/b and it will continue in the right way. If the two SB-sequences for x and y are both seeded with (0,1), you get this 45° line, because each successive a/b for (x,y) is identical:

Stern-Brocot pairs seeded with x ← (0,1) and y ← (0,1)


The further you extend the sequences, the less broken the 45° line will appear, because the points determined by a/b for x and y will get closer and closer together (but the line will never be solid, because any two rationals are separated by an infinity of irrationals). Now try offsetting the SB-sequences for x,y by using different seeds. Different fractal patterns appear, which all appear to be subsets (or fractions) of the limestone fractal above (see animated gif below):

Stern-Brocot pairs seeded with x ← (0,1) and y ← (1,1)


x ← (0,1) and y ← (1,2)


x ← (0,1) and y ← (1,3)


x ← (0,1) and y ← (2,3)


x ← (0,1) and y ← (3,4)


x ← (0,1) and y ← (6,7)


x ← (1,2) and y ← (1,9)


x ← (1,4) and y ← (1,6)


x ← (1,7) and y ← (1,8)


x ← (2,3) and y ← (4,5) — apparently identical to x ← (1,4) and y ← (1,6) above


x ← (26,25) and y ← (1,10)


Gryke fractal compared with Stern-Brocot-pair patterns (animated at ezGif)


And here’s what happens when the seed-fractions for x run from 1/3 to 12/13, while the seed-fraction for y is held constant at 1/23:

x ← (1,13) and y ← (1,23)


x ← (2,13) and y ← (1,23)


x ← (3,13) and y ← (1,23)


x ← (4,13) and y ← (1,23)


x ← (5,13) and y ← (1,23)


x ← (6,13) and y ← (1,23)


x ← (7,13) and y ← (1,23)


x ← (8,13) and y ← (1,23)


x ← (9,13) and y ← (1,23)


x ← (10,13) and y ← (1,23)


x ← (11,13) and y ← (1,23)


x ← (12,13) and y ← (1,23)


Animated gif for x ← (n,13) and y ← (1,23) (animated at ezGif)


Previously Pre-Posted

I Like Gryke — a first look at the limestone fractal
Lime Time — more on the fractal