login
The relative direction (0=straight ahead, 1=turn right, 2=turn left) taken by the type I Hilbert's Hamiltonian walk A163359 at the step n.
4

%I #9 Aug 07 2015 11:14:55

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

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

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

%N The relative direction (0=straight ahead, 1=turn right, 2=turn left) taken by the type I Hilbert's Hamiltonian walk A163359 at the step n.

%C a(16*n) = a(256*n) for all n.

%H A. Karttunen, <a href="/A163543/b163543.txt">Table of n, a(n) for n = 1..4096</a>

%F a(n) = A163241((A163541(n+1)-A163541(n)) modulo 4).

%t HC = {

%t L[n_ /; IntegerQ[n/2]] :> {F[n], L[n], L[n + 1], R[n + 2]},

%t R[n_ /; IntegerQ[(n + 1)/2]] :> {F[n], R[n], R[n + 3], L[n + 2]},

%t R[n_ /; IntegerQ[n/2]] :> {L[n], R[n + 1], R[n], F[n + 3]},

%t L[n_ /; IntegerQ[(n + 1)/2]] :> {R[n], L[n + 3], L[n], F[n + 1]},

%t F[n_ /; IntegerQ[n/2]] :> {L[n], R[n + 1], R[n], L[n + 3]},

%t F[n_ /; IntegerQ[(n + 1)/2]] :> {R[n], L[n + 3], L[n], R[n + 1]}};

%t a[1] = F[0]; Map[(a[n_ /; IntegerQ[(n - #)/16] ] := Part[Flatten[a[(n + 16 - #)/16] /. HC /. HC],#]) &, Range[16]];

%t Part[a[#] & /@ Range[4^4] /. {L[_] -> 2, R[_] -> 1, F[_] -> 0}, 2 ;; -1] (* _Bradley Klee_, Aug 06 2015 *)

%o (Scheme:) (define (A163543 n) (A163241 (modulo (- (A163541 (1+ n)) (A163541 n)) 4)))

%Y a(n) = A014681(A163542(n)). See also A163541.

%K nonn

%O 1,1

%A _Antti Karttunen_, Aug 01 2009