A246960 Directions of the lines in the (Heighway) Dragon Curve.
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, 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, 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
Offset: 0
Links
- Joerg Arndt, Table of n, a(n) for n = 0..16383
- Joerg Arndt, Matters Computational (The Fxtbook), 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.
Crossrefs
Programs
-
Mathematica
Nest[Flatten[# /. {0 -> {0, 1}, 1 -> {2, 1}, 2 -> {2, 3}, 3 -> {0, 3}}] &, {0}, 7]
-
Python
def A246960(n): return (n^(n>>1)).bit_count()&3 # Chai Wah Wu, Jul 13 2024
Formula
a(n) = A005811(n) mod 4. - Joerg Arndt, Sep 09 2014
a(n) = A105500(n) - 1. - Filip Zaludek, Dec 16 2016
Comments