%I #64 Jul 02 2022 01:52:10
%S 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,
%T 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,
%U 0,1,0,3,0,1,0,2,0,1,0,0,0,1,0,2,0,1,0
%N Symbolic code for the corner turns in the Lévy dragon curve.
%C 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).
%C 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.
%C 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.
%D 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.
%H Larry Riddle, <a href="/A346070/b346070.txt">Table of n, a(n) for n = 1..4094</a>
%H Paul Lévy, <a href="https://gallica.bnf.fr/ark:/12148/bpt6k57344323/f53.image">Les courbes planes ou gauches et les surfaces composées de parties semblables au tout</a>, Journal de l'École Polytechnique, July 1938 pages 227-247, and <a href="https://gallica.bnf.fr/ark:/12148/bpt6k57344820/f3.image">continued</a> October 1938 pages 249-292, curve C.
%H Larry Riddle, <a href="https://larryriddle.agnesscott.org/ifs/levy/LevyCode.htm">Representing the Levy Dragon Curve Symbolically</a>
%H Larry Riddle, <a href="https://larryriddle.agnesscott.org/ifs/levy/Levy1234codes5.png">First 31 terms</a>, where R=0, S=1, L=2, and B=3.
%H <a href="/index/Fi#FIXEDPOINTS">Index entries for sequences that are fixed points of mappings</a>
%F a(n) = (A092412(n) - 1) mod 4.
%F a(2n-1) = 0, a(2n) = (a(n)+1) mod 4 = A092412(n).
%F 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.
%F a(n) = A007814(n) mod 4.
%e 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.
%e -- -- -- --
%e | || |
%e -- --
%e | |
%e | |
%e -- * --
%e start
%o (Python)
%o def A346070(n): return (~n & n-1).bit_length() & 3 # _Chai Wah Wu_, Jul 01 2022
%Y Cf. A092412 (essentially the same), A007814.
%K easy,nonn
%O 1,4
%A _Larry Riddle_, Jul 04 2021