The assumption of D being smaller than N can be relaxed. Suppose for the moment that N < D” < 2 * N  (optionally after decreasing D” modulo 2*N). The figure with this value of D” is similar to the figure with D = 2*N – D” (apart from a figure’s translation). The proof is based on operations on the full array of directions. The recipe for pair (N, D) can be written as [ R f(R,L) ] where f(R,L) denotes the partial recipe from the second direction to the Nth direction. Note that the first direction of the recipe (R) is an arbitrary choice; we could have chosen L instead of R as well. The partial recipe f has an anti-symmetry property. If the first direction of f is R, then the last direction is L, and vice versa. And this property holds also for the other pairs of directions in f. Consider the full array of directions for the figure with D” = 2*N – D. This array equals [ R f(L,R) ]6, where f(R,L) is the partial recipe based on D. When we mirror (with respect to the initial orientation) drawing this array, then we get the array [ L f(R,L) ]6 . Note that the drawing shows an anti-clockwise rotation. Now, start the drawing from the second direction so that the (cyclic) array becomes [ f(R,L) L ]6 . Finally, traverse the drawing in opposite direction starting at the last direction. This means that all directions are reversed from R to L, and from L to R . Furthermore, note that the clockwise rotation of the drawing is restored. Due to the anti-symmetry of f(R,L), the array becomes [ R f(R,L) ]6, being the array of the figure with D.


A recipe can be decomposed in one or more chunks RpLq, where Rp denotes p times direction R and Lq denotes q times direction L. The values p and q depend on the input numbers N and D. Define the characteristic equation N = K*D + E, where K > 0 and 0 < E < D .

3 situations can be discerned

a)      2*N = (2*K+1) * D

So, D = 2*E and N = (2*K+1)*E . Since N and D are relatively prime, the value of E must be 1, and hence D=2. The corresponding recipe, equal to R(N+1)/2 L(N-1)/2 has a primitive structure.

b)      2*N < (2*K+1) * D

This situation is equivalent to E < D/2. The chunks look like RK+1 LK , or RK LK+1, or RK LK . Their multiplicities can be derived by comparing multiples of D with the boundaries N and 2*N . The values of the multiplicities are respectively (E+1)/2, (E-1)/2, and (D/2-E) .

c)      2*N > (2*K+1) * D

In this situation, equivalent to E > D/2, the chunks look slightly different, namely RK+1 LK+1, or RK+1 LK , or RK LK+1 . For simplifying the formulas we introduce the variable F := D-E . The multiplicities of the chunks are then respectively (D/2-F), (F+1)/2, and (F-1)/2 .

For all 3 situations can be easily verified that the recipe contains N directions, and that the number of R directions is 1 more than the number of L directions.


Figures with small values for N and D are quite simple, comparable to situation a). On the other hand, figures with big values may become fairly complex. But one can observe that such complex figures have roughly simpler forms with some small pattern on top of it. In the sequel we will show how complex figures relate mathematically to simpler figures.
Consider situation b) at the Analysis section. The chunk
RK LK can be considered as a small pattern inside the figure. The position before and after drawing this pattern might be changed, but the orientation remains the same. However, the other 2 types of chunks do change the orientation to the right (for RK+1 LK) or to the left (for RK LK+1). A new, reduced figure can be constructed by ignoring the chunks RK LK, and by replacing chunk RK+1 LK with a single direction R, and similarly replacing RK LK+1 with L. This new figure has a recipe with N’ = E directions.
We will prove, with some geometrical support, that the new denominator D' equals D mod (2*N’), and that the replaced chunks correspond to the recipe based on pair (N’, D’).
Consider a 2-
dimensional coordinate system with a horizontal x-axis and a vertical y-axis. Define the points (t*D, t*D) where t runs from 0 to N . The first N points correspond to the points for constructing the recipe. All these points lie on a straight line at equidistant pieces. Along the x-axis we focus on multiples of D. Therefore, we can scale the points to (t, t*D). Along the y-axis we focus on multiples of N. Also this axis is scaled, but now by a factor N, yielding points (t, t*D/N) . The points still lie on a straight line at equidistant pieces running from (0,0) to (N,D). (Note the analogy of drawing a line on a graphics display.) Consider the D rows between coordinates y and y+1 where y runs from 0 to D-1. Each row covers either K points or K+1 points from the line. A row with even y-coordinate contains points that yield an R direction, and a row with odd y-coordinate contains points yielding an L direction. An even row and an odd row together relate to a chunk; so, it is clear that a recipe has D/2 chunks.
The rows cut the line in equal parts. Each part has a length along the x-axis of N/D = K + E/D
. The right hand side has 2 terms: K is the minimum number of points that are always present in a row; the term E/D is responsible for the (K+1)th points after accumulation of some rows. Considering N = N(K) as a function of K, the row location of the additional point does not depend on K, because E/D and K are independent. So, we can take K=0, and consider the problem of the E additional points (t, t*D/E) that are located equidistant on a line from (0,0) to (E, D). Now, the line is transformed, such that from each point the y-value t*2 is subtracted. This is possible since E<D/2 . All the transformed points remain equidistant at a straight line. Furthermore, a point at an even row lands again in an even row, and the same holds for the odd rows. So, the directions of the points are preserved. The end coordinate of the line becomes (E, D-2*E) . The transformation is repeated until the end coordinate becomes (E, D mod (2*E)), being the end coordinate (N’, D’) of the reduced line. The configuration of the line from (0,0) to (N’, D’) is analoguous to the configuration of the original line from (0, 0) to (N, D) . Therefore, we conclude that the reduced line corresponds to a figure based on the numbers N’ and D’.

Now, consider situation c) being a bit trickier because the reduced number of directions N’ equals (F+1)/2 + (F-1)/2 = F . We will show that the reduced value D’ equals D mod (2*F). For this proof the line configuration is transformed extensively. As in situation b) the line can be reduced to: (0, 0) -> (E, D) . Subtract the line (0, 0) -> (E, 2*E), so that all directions are preserved. This gives (0, 0) -> (E, D-2*E) with an end point below the x-axis. So, add the constant 2*E-D to all y-coordinates yielding (0, 2*E-D) -> (E, 0) . Applying a mirror transformation with respect to x = E/2 results again in a line through the origin: (0, 0) -> (E, 2*E-D). Since E> 2*E-D we can reduce this line, just as we reduced the original line by subtracting D from N . This gives the line (0, 0) -> (D-E, 2*E-D). From the endpoint's y-coordinate we can subtract multiples of 2*(D-E) . Since we can also add once 2*(D-E), the y-coordinate can be reduced to D mod (2*(D-E)) = D mod (2*F).

The conclusion is that we can reduce a figure with N and D to a reduced figure with N’ and D’ as follows. Define E = N mod D, so that:


Reducing a figure can be done repetitively. Therefore, we speak of so called generations. Reducing a figure leads to a lower generation. After a finite number of reductions the lowest generation (a primitive structure) has been reached.
On the other hand, a figure can be designed by building higher generations from a given initial pair (N, D) . Denote the next higher generation figure by (N”, D”) with accompanying E" and K" . There are 2 possibilities. Firstly assume E” < D”/2 . In that case E” = N, and D” = D + s * 2*N for any positive integer s, since E” < D”/2 is always satisfied. An arbitrary positive integer K” can be chosen so that N” = K” * D” + E” .
Secondly, assume E” > D”/2. Then, again D” = D + s * 2*N for any positive integer s, because E” = D” - N will satisfy E” > D”/2 . And again for any positive integer K” holds N” = K” * D” + E” .

For example, take as lowest generation the figure based on (5,2), a next higher generation is the figure based on (29,12),


.... and again a next higher generation is the figure based on (309,70) .


Building higher generations can be done repetitively. When using the same values for K" and s in each generation, the figure gets the appearance of a fractal !

Irrational numbers

The procedure of computing directions and drawing a figure can be generalised to (positive) irrational numbers. However, the problem is then that these figures have an infinite size. So, a figure can only be drawn partly after computing a finite number of directions.
The formula is similar to the rational numbers: N = K * D + E , where N, D and E are positive irrational numbers, K is a positive integer, and 0 < E < D . In principle D < N ; bigger values of D can be transformed just as for the rational numbers:

The rules for reduction are similar as for the rational numbers.
A figure can be reduced to remove the "noise" of the higher generations. Because of the irrational numbers a reduction process newer ends. A figure based on irrational numbers can be approximated for gaining insight, as follows. Reduce the figure for a few generations, and store the values of K and s . Replace the (reduced) values of N and D at the lowest generation by resembling integers. And then build up the higher generations again using the stored values of K and s. For example the pair (π, 1) can be approximated by (3230883, 1028422) .

Because of the usage of irrational numbers we can divide both sides of the characteristic equation by the same value without any further consequences. An advantage for doing such a division is to scale the numbers to convenient values. The equation can always be scaled such that D becomes 1 . In that situation, we define the numbers as being normalised.

Continued fraction

The relationship between a pair (N,D) and a reduced pair (N’, D’) can be rearranged according to the structure of a continued fraction (CF) . Four situations can be distinguished. We start again with the characteristic equation: N = K * D + E .

Case 1 : E < D/2

          Reduction : N’ = E and D’ = D mod( 2*N’) = D - 2 * s * N’

          Case 1A: D’ < N’


          Case 1B: D’ > N’

                            with D” = 2*N’ - D’

Case 2 : E > D/2

          Reduction : N’ = D - E and D’ = D mod( 2*N’) = D - 2 * s * N’

          Case 2A: D’ < N’


          Case 2B: D’ > N’

                            with D” = 2*N’ - D’


As already mentioned above, the possibility exists to generate fractal figures. The easiest way to derive a fractal is by reducing a pair (N,D) such that the reduced pair (N’,D’) is equivalent to (N, D); i.e., the normalised values of (N, D) and (N’,D’) are equal. Two situations can be discerned depending on the size of E. Firstly, consider E < D/2. Then N’ = E and D’ = D-2*s*E . Define the ratio δ := N/D . Demanding that δ must equal the normalised value of (N’,D’) leads to the quadratic equation with (positive) solution:

Secondly, consider E > D/ 2 . In that case N’ = D-E and D’ = D-2*s*(D-E) . This leads to another quadratic equation with as (positive) solution:

For example, take in the latter case: K=1, s = 1, yielding δ = ( 1 + sqrt(5) )/2, being the golden ratio. Note that building the generations starting with the triple (N=3, D=2, E= 1) results in numbers of the Fibonacci sequence.

Let's take another example, namely K=7, s=1, E > D/2. This leads to the following stunning results:


generation 2,  with  N=3809,  D=510; and


generation 3,  with  N=60705,  D=8128.
At each generation the plane is partly filled with basic, hexagonal tiles with an increasing snowflake being left uncovered. 
You can also view these figures with improved resolution in SVG format:
3809_510 (110 kB) ,  generation 3 60705_8128 (1.8 MB). Note that for watching these figures, your browser needs an SVG plug-in. Alternatively, you can download the SVG files ( 3809_510.svg and 60705_8128.svg ) and view them with an SVG-viewer, like the open source Inkscape program .


The figures designed above yield hexagons, since the rotated orientation to the left or right equals 360 / 6 = 60 degrees. This angle of 60 degrees comes from the choosen tiling of triangles. A full rotation of 360 degrees is divided in 6 parts. However, in the second phase of the algorithm we can divide the 360 degrees also in other parts. A division in 3 parts yields triangles, and a division in 4 parts yields squares. These values result in regular tilings. But, nothing stops us from dividing the 360 degrees in other parts, e.g. 5, 7, or 8 parts causing weird or beautiful figures. All these values have been implemented in the Java demonstration software (see downloads).

For example, N=143, D=40, shape=5 yields :