cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A346070 Symbolic code for the corner turns in the Lévy dragon curve.

Original entry on oeis.org

0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 1, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 0, 0, 1, 0, 2, 0, 1, 0
Offset: 1

Views

Author

Larry Riddle, Jul 04 2021

Keywords

Comments

We consider the Lévy dragon curve as constructed using line segments starting with an initial horizontal segment. The left endpoint of this segment is considered the beginning of the curve. Let L(k) denote the k-th iteration. It consists of 2^k segments and 2^k-1 corners. To get the next iteration, L(k+1), each of the segments in L(k) is replaced by two segments at right angles, always placing those segments towards the left of the segment in L(k).
Each iteration can be represented symbolically by a sequence consisting of the integers 0, 1, 2, and 3. One can imagine moving along the individual segments making up the curve starting at the left endpoint. A corner is labeled 0 if the curve makes a right turn there of 90 degrees, is labeled 2 if the curve makes a left turn of 90 degrees at that corner, is labeled 1 if the curve continues straight at that corner (0 degree turn), and is labeled 3 if the curve makes a 180-degree turn at that corner. The Lévy dragon is equal to the limit of L(k) as k goes to infinity.
It makes sense, as Knuth and Davis remarked in their article about the Heighway dragon, to express the Lévy dragon as the infinite sequence of 0's, 1's, 2's, and 3's obtained as each finite sequence for L(k) is extended to the limit. Then a(n) is the code for the behavior of the n-th corner in this infinite sequence.

Examples

			The first 15 terms correspond to iteration L(4) of the Levy dragon curve. These terms are 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0. The initial direction of the curve is 4*45=180 degrees (due west). The 15 terms indicate that the curve follows the pattern shown below.
      -- --  -- --
     |     ||     |
   --              --
  |                  |
  |                  |
   -- *            --
     start
		

References

  • Paul Lévy, "Plane or space curves and surfaces consisting of parts similar to the whole," in Classics on Fractals, Gerald A. Edgar, Editor, Addison-Wesley, 181-239.

Crossrefs

Cf. A092412 (essentially the same), A007814.

Programs

  • Mathematica
    Mod[IntegerExponent[Range[100], 2], 4] (* Paolo Xausa, Feb 25 2025 *)
  • Python
    def A346070(n): return (~n & n-1).bit_length() & 3 # Chai Wah Wu, Jul 01 2022

Formula

a(n) = (A092412(n) - 1) mod 4.
a(2n-1) = 0, a(2n) = (a(n)+1) mod 4 = A092412(n).
Write n = k*4^m where k is not a multiple of 4. If k is odd, then a(n) = (2m) mod 4, and if k is even, then a(n) = (2m+1) mod 4.
a(n) = A007814(n) mod 4.