login
Directions of the lines in the (Heighway) Dragon Curve.
7

%I #20 Jul 13 2024 17:50:59

%S 0,1,2,1,2,3,2,1,2,3,0,3,2,3,2,1,2,3,0,3,0,1,0,3,2,3,0,3,2,3,2,1,2,3,

%T 0,3,0,1,0,3,0,1,2,1,0,1,0,3,2,3,0,3,0,1,0,3,2,3,0,3,2,3,2,1,2,3,0,3,

%U 0,1,0,3,0,1,2,1,0,1,0,3,0,1,2,1,2,3,2,1,0,1,2,1,0,1,0,3,2,3,0,3,0,1,0,3,0

%N Directions of the lines in the (Heighway) Dragon Curve.

%C Fixed point of the morphism: 0 --> 01, 1 --> 21, 2 --> 23, 3 --> 03.

%H Joerg Arndt, <a href="/A246960/b246960.txt">Table of n, a(n) for n = 0..16383</a>

%H Joerg Arndt, <a href="http://www.jjj.de/fxt/#fxtbook">Matters Computational (The Fxtbook)</a>, pp. 88-92; image of the dragon curve on p. 89 (top): 0 for north, 1 for west, 2 for south, and 3 for east.

%F a(n) = A005811(n) mod 4. - _Joerg Arndt_, Sep 09 2014

%F a(n) = A105500(n) - 1. - _Filip Zaludek_, Dec 16 2016

%t Nest[Flatten[# /. {0 -> {0, 1}, 1 -> {2, 1}, 2 -> {2, 3}, 3 -> {0, 3}}] &, {0}, 7]

%o (Python)

%o def A246960(n): return (n^(n>>1)).bit_count()&3 # _Chai Wah Wu_, Jul 13 2024

%Y Cf. A014577, A106665.

%Y n where a(n) = 0,1,2,3 respectively: A043724, A043725, A043726, A043727.

%K nonn,easy

%O 0,3

%A _Robert G. Wilson v_, Sep 08 2014