%I #23 Nov 09 2023 11:06:05
%S 0,1,1,-1,-1,0,0,0,1,1,-1,-1,0,1,0,1,1,-1,-1,0,1,0,1,1,-1,-1,0,-1,0,1,
%T 1,-1,-1,0,-1,0,1,1,-1,-1,0,0,0,1,1,-1,-1,0,0,0,1,1,-1,-1,0,0,0,1,1,
%U -1,-1,0,1,0,1,1,-1,-1,0,1,0,1,1,-1,-1,0,-1,0,1
%N Fixed point of morphism 0->0PPMM00, P->0PPMM0P, M=0PPMM0M (where P=+1, M=-1)
%C Turns by 120 degrees of a dragon curve (see fxtbook link below).
%C Also fixed point of morphism F->F0FPFPFMFMF0F, 0->0, P->P, M->M (after deleting all F).
%C Let d(n) be the lowest nonzero digit in the radix-7 expansion of (n+1), then if d(n)==[1,2,3,4,5,6] ==> a(n):=[0,+1,+1,-1,-1,0].
%C This is a 7-automatic sequence. - _Joerg Arndt_, Nov 09 2023
%H Paolo Xausa, <a href="/A176416/b176416.txt">Table of n, a(n) for n = 0..10000</a>
%H Joerg Arndt, <a href="http://www.jjj.de/fxt/#fxtbook">Matters Computational (The Fxtbook)</a>, section 1.31.5 "Dragon curves based on radix-R counting", pp.95-101; image on p.98
%t Nest[Flatten[ReplaceAll[#,{-1->{0,1,1,-1,-1,0,-1},0->{0,1,1,-1,-1,0,0},1->{0,1,1,-1,-1,0,1}}]]&,{0},3] (* _Paolo Xausa_, Nov 09 2023 *)
%o (C++) /* CAT-algorithm */
%o int bit_dragon_r7_2_turn(unsigned long &x)
%o /* Increment the radix-7 word x and return (tr)
%o according to the lowest nonzero digit d of the incremented word:
%o d==[1,2,3,4,5,6] ==> rt:=[0,+1,+1,-1,-1,0] */
%o {
%o unsigned long s = 0;
%o while ( (x & 7) == 6 ) { x >>= 3; ++s; } /* scan over nines */
%o ++x; /* increment next digit */
%o int tr = 2 - ( (0x2f58 >> (2*(x&7)) ) & 3 ); x <<= (3*s); /* shift back */
%o return tr;
%o }
%Y Cf. A080846 (with terdragon curve), A014577 (with Heighway dragon), A175337 (with R5-dragon), and A176405 (with R7-dragon).
%K sign
%O 0,1
%A _Joerg Arndt_, Apr 17 2010